X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXDupe.pm;h=d514affde180cc996461eed5c6b7fd79610afdf5;hb=dbdb898e15aaeeac6106b4f49262a16c84177226;hp=4cc2be6ff936fccb7fb6693b642daade97b7ca19;hpb=dbf7523a9b228dbdf1d03109afde351b8b194fab;p=spider.git diff --git a/perl/DXDupe.pm b/perl/DXDupe.pm index 4cc2be6f..d514affd 100644 --- a/perl/DXDupe.pm +++ b/perl/DXDupe.pm @@ -20,14 +20,19 @@ $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; + +main::mkver($VERSION = q$Revision$); sub init { - $dbm = tie (%d, 'DB_File', $fn) or confess "can't open dupe file: $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; + } } sub finish @@ -47,7 +52,7 @@ sub check sub find { - return 1 if exists $d{$_[0]}; + return $d{$_[0]}; } sub add