and again
[spider.git] / perl / Geomag.pm
index e84e5d50c35a5d4a472800713cd02480c81ea084..05aefeff05cf90ea7dd60441ff340db81561a091 100644 (file)
@@ -43,7 +43,6 @@ $param = "$dirprefix/param";
 sub init
 {
        $fp = DXLog::new('wwv', 'dat', 'm');
-       mkdir $dirprefix, 0777 if !-e $dirprefix; # now unnecessary DXLog will create it
        do "$param" if -e "$param";
        confess $@ if $@;
 }
@@ -253,12 +252,11 @@ sub dup
        # dump if too old
        return 2 if $d < $main::systime - $dupage;
  
-       $d /= 60;                            # to the nearest minute
-       chomp $text;
-       $text = substr($text, 0, $duplth) if length $text > $duplth; 
-       my $dupkey = "$d|$sfi|$k|$a|$text";
+#      chomp $text;
+#      $text = substr($text, 0, $duplth) if length $text > $duplth; 
+       my $dupkey = "$d|$sfi|$k|$a";
        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; 
 }
 
@@ -273,12 +271,16 @@ 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;
 __END__;
+