made some changes for perl 5.6
[spider.git] / perl / AnnTalk.pm
index b082c38531bd0f77707129db1ac37b2250e62a86..a6032363ac5e7cf5d847a288e36ed4f64bcd952f 100644 (file)
@@ -23,14 +23,14 @@ $dupage = 24*3600;               # the length of time to hold spot dups
 sub dup
 {
        my ($call, $to, $text) = @_; 
-       my $d = $main::systime / 60;
+       my $d = $main::systime;
 
        chomp $text;
        unpad($text);
        $text = substr($text, 0, $duplth) if length $text > $duplth; 
        my $dupkey = "$call|$to|$text";
        return 1 if exists $dup{$dupkey};
-       $dup{$dupkey} = $d * 60;         # in seconds (to the nearest minute)
+       $dup{$dupkey} = $d;         # in seconds (to the nearest minute)
        return 0; 
 }
 
@@ -45,13 +45,17 @@ sub process
 
 sub listdups
 {
+       my $regex = shift;
+       $regex = '.*' unless $regex;
+       $regex =~ s/[\$\@\%]//g;
        my @out;
-       for (sort { $dup{$a} <=> $dup{$b} } keys %dup) {
+       for (sort { $dup{$a} <=> $dup{$b} } grep { m{$regex}i } keys %dup) {
                my $val = $dup{$_};
-               push @out, "$_ = $val (" . cldatetime($val) . ")";
+               push @out, "$_ = " . cldatetime($val);
        }
        return @out;
 }
 
+
 1;