From: Dirk Koopman Date: Sun, 26 Apr 2020 13:02:48 +0000 (+0100) Subject: fix DXUtil::localdata ?perl bug? X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=a645d1b0058cd4a02d88d5657ed915fc6e88b1a7;p=spider.git fix DXUtil::localdata ?perl bug? --- diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index b669b3b3..8bb9b956 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -477,10 +477,10 @@ sub localdata if (-e "$main::local_data") { $tfn = "$main::data/$ifn"; - if (-e $tfn && -e $ofn) { + if ((-e $tfn) && (-e $ofn)) { $ofn = $tfn if -M $ofn < -M $tfn; - } elsif (-e tfn) { - $ofn = $tfn; + } else { + $ofn = $tfn if -e $tfn; } } diff --git a/perl/Prefix.pm b/perl/Prefix.pm index fd361eba..1e74d63d 100644 --- a/perl/Prefix.pm +++ b/perl/Prefix.pm @@ -73,6 +73,8 @@ sub load eval {$db = tie(%pre, "DB_File", undef, O_RDWR|O_CREAT, 0664, $DB_BTREE);}; my $out = "$@($!)" if !$db || $@ ; my $fn = localdata("prefix_data.pl"); + die "Prefix.pm: cannot find $fn, have you run /spider/perl/create_prefix.pl?" unless -e $fn; + eval {do $fn if !$out; }; $out .= $@ if $@; $lru = LRU->newbase('Prefix', $lrusize);