X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXDupe.pm;h=9198aee6c050939b2d5852f81d089683938835da;hb=770092d94f96b6d22a38fb33e0056b4779a8a1ab;hp=1dd7c700ff9fdbc0fc40202e6c6a7df328a79d0a;hpb=1b32fc130b298c8ce803a340d8efdf86b4e475f8;p=spider.git diff --git a/perl/DXDupe.pm b/perl/DXDupe.pm index 1dd7c700..9198aee6 100644 --- a/perl/DXDupe.pm +++ b/perl/DXDupe.pm @@ -19,22 +19,11 @@ $default = 48*24*60*60; $lasttime = 0; $fn = "$main::data/dupefile"; -use vars qw($VERSION $BRANCH); -$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); -$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)); -$main::build += $VERSION; -$main::branch += $BRANCH; - 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 @@ -42,6 +31,12 @@ sub finish undef $dbm; untie %d; undef %d; + unlink $fn; +} + +sub active +{ + return $dbm; } sub check