2 # class to handle all dupes in the system
4 # each dupe entry goes into a tied hash file
6 # the only thing this class really does is provide a
7 # mechanism for storing and checking dups
16 use vars qw{$lasttime $dbm %d $default $fn};
18 $default = 48*24*60*60;
20 $fn = "$main::data/dupefile";
24 $dbm = tie (%d, 'DB_File', $fn) or confess "can't open dupe file: $fn ($!)";
36 return 1 if exists $d{$s};
37 $t = $main::systime + $default unless $t;
51 if ($main::systime - $lasttime >= 3600) {
52 while (($k, $v) = each %d) {
53 delete $d{$k} if $main::systime >= $v;
55 $lasttime = $main::systime;
63 while (($k, $v) = each %d) {
64 push @out, $k, $v if !$start || $k =~ /^$start/;
75 $regex =~ s/[\^\$\@\%]//g;
76 $regex = ".*$regex" if $regex;
77 $regex = "^$let" . $regex;
79 for (sort { $d{$a} <=> $d{$b} } grep { m{$regex}i } keys %d) {
80 my ($dum, $key) = unpack "a1a*", $_;
81 push @out, "$key = " . cldatetime($d{$_} - $dupage);