projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
route the right thing in the user portion of PC16
[spider.git]
/
perl
/
DXDupe.pm
diff --git
a/perl/DXDupe.pm
b/perl/DXDupe.pm
index 5a01bee99a6acdfa1e6e39c204e623a2d1c46ba4..fb1210a2a15b7186c11980712b52ba6120d80a1d 100644
(file)
--- a/
perl/DXDupe.pm
+++ b/
perl/DXDupe.pm
@@
-21,13
+21,20
@@
$fn = "$main::data/dupefile";
use vars qw($VERSION $BRANCH);
$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
use vars qw($VERSION $BRANCH);
$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
-$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/
) || 0
;
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/
|| (0,0))
;
$main::build += $VERSION;
$main::branch += $BRANCH;
sub init
{
$dbm = tie (%d, 'DB_File', $fn) or confess "can't open dupe file: $fn ($!)";
$main::build += $VERSION;
$main::branch += $BRANCH;
sub init
{
$dbm = tie (%d, 'DB_File', $fn) or confess "can't open dupe 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 finish
@@
-40,10
+47,21
@@
sub finish
sub check
{
my ($s, $t) = @_;
sub check
{
my ($s, $t) = @_;
- return 1 if exists $d{$s};
+ return 1 if find($s);
+ add($s, $t);
+ return 0;
+}
+
+sub find
+{
+ return 1 if exists $d{$_[0]};
+}
+
+sub add
+{
+ my ($s, $t) = @_;
$t = $main::systime + $default unless $t;
$d{$s} = $t;
$t = $main::systime + $default unless $t;
$d{$s} = $t;
- return 0;
}
sub del
}
sub del