X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXDupe.pm;h=b7d2618a9196fd67e94919795edd61ec0cebdc2a;hb=331ae9a34defd23c476ceaecdf29d9f49b60faed;hp=fb1210a2a15b7186c11980712b52ba6120d80a1d;hpb=070310c653f25c63a719396a32c216b5ce8b9dee;p=spider.git diff --git a/perl/DXDupe.pm b/perl/DXDupe.pm index fb1210a2..b7d2618a 100644 --- a/perl/DXDupe.pm +++ b/perl/DXDupe.pm @@ -27,7 +27,7 @@ $main::branch += $BRANCH; 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..."); @@ -46,21 +46,21 @@ sub finish sub check { - my ($s, $t) = @_; + my $s = shift; return 1 if find($s); - add($s, $t); + add($s, shift); return 0; } sub find { - return 1 if exists $d{$_[0]}; + return $d{$_[0]}; } sub add { - my ($s, $t) = @_; - $t = $main::systime + $default unless $t; + my $s = shift; + my $t = shift || $main::systime + $default; $d{$s} = $t; }