$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;
-$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
sub find
{
- return 1 if exists $d{$_[0]};
+ return $d{$_[0]};
}
sub add