projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
severe munging of code in prepartion for newprotocol
[spider.git]
/
perl
/
DXDupe.pm
diff --git
a/perl/DXDupe.pm
b/perl/DXDupe.pm
index cd4272c787530d24473dc821fcd7b724596762c9..fb1210a2a15b7186c11980712b52ba6120d80a1d 100644
(file)
--- a/
perl/DXDupe.pm
+++ b/
perl/DXDupe.pm
@@
-19,24
+19,49
@@
$default = 48*24*60*60;
$lasttime = 0;
$fn = "$main::data/dupefile";
$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
{
$dbm = tie (%d, 'DB_File', $fn) or confess "can't open dupe file: $fn ($!)";
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
{
undef $dbm;
untie %d;
}
sub finish
{
undef $dbm;
untie %d;
+ undef %d;
}
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