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 ($!)";
37 return 1 if exists $d{$s};
38 $t = $main::systime + $default unless $t;
52 if ($main::systime - $lasttime >= 3600) {
53 while (($k, $v) = each %d) {
54 delete $d{$k} if $main::systime >= $v;
56 $lasttime = $main::systime;
64 while (($k, $v) = each %d) {
65 push @out, $k, $v if !$start || $k =~ /^$start/;
76 $regex =~ s/[\^\$\@\%]//g;
77 $regex = ".*$regex" if $regex;
78 $regex = "^$let" . $regex;
80 for (sort { $d{$a} <=> $d{$b} } grep { m{$regex}i } keys %d) {
81 my ($dum, $key) = unpack "a1a*", $_;
82 push @out, "$key = " . cldatetime($d{$_} - $dupage);