X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXDupe.pm;h=ebb2aac41a7c157f5be5986c9384cce2143a399a;hb=refs%2Fheads%2Fnew-spawn;hp=a5bb8a1b9cd762f9d4bdd0e1e2208f07743ba244;hpb=011ea517c23d99f17495e50ae05c183bb21fe50f;p=spider.git diff --git a/perl/DXDupe.pm b/perl/DXDupe.pm index a5bb8a1b..ebb2aac4 100644 --- a/perl/DXDupe.pm +++ b/perl/DXDupe.pm @@ -17,21 +17,14 @@ use vars qw{$lasttime $dbm %d $default $fn}; $default = 48*24*60*60; $lasttime = 0; -$fn = "$main::data/dupefile"; - -use vars qw($VERSION $BRANCH); -($VERSION, $BRANCH) = dxver(q$Revision$); +localdata_mv("dupefile"); +$fn = localdata("dupefile"); sub init { + unlink $fn; $dbm = tie (%d, 'DB_File', $fn); - unless ($dbm) { - eval { untie %d }; - dbg("Dupefile $fn corrupted, removing..."); - unlink $fn; - $dbm = tie (%d, 'DB_File', $fn) or confess "can't open dupe file: $fn ($!)"; - confess "cannot open $fn $!" unless $dbm; - } + confess "cannot open $fn $!" unless $dbm; } sub finish @@ -39,6 +32,7 @@ sub finish undef $dbm; untie %d; undef %d; + unlink $fn; } sub check