From a645d1b0058cd4a02d88d5657ed915fc6e88b1a7 Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Sun, 26 Apr 2020 14:02:48 +0100 Subject: [PATCH] fix DXUtil::localdata ?perl bug? --- perl/DXUtil.pm | 6 +++--- perl/Prefix.pm | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) 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); -- 2.43.0