+my $RealBin = ".";
foreach my $req (@request) {
###############################
if ($server =~ /HTTPi/i) {
$isbrowser = 1;
($entity,$netaddr,$name,$style) = split("-",$req);
- $file = "htdocs/xml-db/cache/$entity.entity";
+ $RealBin = 'htdocs/xml-db';
} else {
# use FindBin qw($RealBin);
- my $RealBin = ".";
+ $RealBin = ".";
$isbrowser = 1;
($entity,$netaddr,$name,$style) = split("-",$req);
- $file = "$RealBin/cache/$entity.entity";
}
- $storefile = "/dev/shm/xmldb-".$req.".store";
+ $storefile = "/dev/shm/xmldb-$req.store";
} else {
# use FindBin qw($RealBin);
my $RealBin = ".";
) or pod2usage(2);
pod2usage(1) if $help;
$entity = $ARGV[0] || "";
- $file = "$RealBin/cache/$ARGV[0].entity";
$netaddr = $ARGV[1] || "";
$name = $ARGV[2] || "";
$style = $ARGV[3] || "";
}
+ $file = "$RealBin/cache/$entity.entity";
+
$style = "" unless $style;
my $isInline = $style =~ /inline/i;
my $isColor = $style =~ /color/i;
#### Check arguments for validity
###############################
- die "Entity $file not found.\n" unless(-e $file) ;
-
+ unless(-e $file) {
+ my $xmlfile = "$RealBin/database/$entity.xml";
+ if(-e $xmlfile) {
+ system("./$RealBin/xml-db.pl");
+ die "Entity $entity not found. Please run xml-db.pl manually.\n" unless(-e $file);
+ }
+ else {
+ die "Entity $entity not found.\n";
+ }
+ }
+
# trim whitespace from netaddr
$netaddr =~ s/^\s+|\s+$//g;
# split off some spi chain, if any, after reading the $db, it is parsed
($netaddr, $spi_chains[0]) = split(':',$netaddr);
- if ($netaddr=~ m/^0x([0-9a-fA-F]{4})$/) {
+ if ($netaddr=~ m/^0x([0-9a-fA-F]{1,4})$/) {
$netaddr = hex($1);
} elsif ($netaddr=~ m/^([0-9]{1,5})$/) {
$netaddr = $1;