#
# This command outputs a list of n lines starting from line $from to $to
#
-sub print
+sub search
{
- my $self = $fp;
my $from = shift;
my $to = shift;
- my @date = $self->unixtoj(shift);
+ my @date = $fp->unixtoj(shift);
my $pattern = shift;
my $search;
- my @in;
my @out;
my $eval;
my $count;
\$ref = \$in[\$c];
if ($search) {
\$count++;
- next if \$count < $from;
- push \@out, print_item(\$ref);
- last LOOP if \$count >= \$to; # stop after n
+ next if \$count < \$from;
+ push \@out, \$ref;
+ last if \$count >= \$to; # stop after n
}
}
);
- $self->close; # close any open files
+ $fp->close; # close any open files
- my $fh = $self->open(@date);
-LOOP:
- while ($count < $to) {
- my @spots = ();
+ my $fh = $fp->open(@date);
+ for ($count = 0; $count < $to; ) {
+ my @in = ();
if ($fh) {
while (<$fh>) {
chomp;
push @in, [ split '\^' ] if length > 2;
}
eval $eval; # do the search on this file
- return ("Spot search error", $@) if $@;
+ return ("Geomag search error", $@) if $@;
+ last if $count >= $to; # stop after n
}
- $fh = $self->openprev(); # get the next file
+ $fh = $fp->openprev(); # get the next file
last if !$fh;
}
return sprintf("$d %02d %5d %3d %3d %-37s <%s>", $t, $ref[2], $ref[3], $ref[4], $ref[5], $ref[0]);
}
+#
+# read in this month's data
+#
+sub readfile
+{
+ my @date = $fp->unixtoj(shift);
+ my $fh = $fp->open(@date);
+ my @spots = ();
+ my @in;
+
+ if ($fh) {
+ while (<$fh>) {
+ chomp;
+ push @in, [ split '\^' ] if length > 2;
+ }
+ }
+ return @in;
+}
1;
__END__;