X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXLogPrint.pm;h=b287413da9a511d7e5cb8e3863889c0228bde6d9;hb=d9db74c1b2b9b57cb6d31e8c8c425f3636f62f87;hp=8a12b05c2791aa3f137fc13ce4f821f1dde5e528;hpb=69c8aeb338cc485103e289fbab7ec4e7e056ed20;p=spider.git diff --git a/perl/DXLogPrint.pm b/perl/DXLogPrint.pm index 8a12b05c..b287413d 100644 --- a/perl/DXLogPrint.pm +++ b/perl/DXLogPrint.pm @@ -8,7 +8,7 @@ package DXLog; -use FileHandle; +use IO::File; use DXVars; use DXDebug (); use DXUtil; @@ -25,15 +25,15 @@ use strict; # sub print { - my $self = $DXLog::log; + my $fcb = $DXLog::log; my $from = shift; my $to = shift; - my @date = $self->unixtoj(shift); + my @date = Julian::unixtojm(shift); my $pattern = shift; my $who = uc shift; my $search; my @in; - my @out; + my @out = (); my $eval; my $count; @@ -50,29 +50,32 @@ sub print \$count++; next if \$count < $from; push \@out, print_item(\$ref); - last LOOP if \$count >= \$to; # stop after n + last if \$count >= \$to; # stop after n } } ); - $self->close; # close any open files + $fcb->close; # close any open files - my $fh = $self->open(@date); -LOOP: - while ($count < $to) { - my @spots = (); + my $fh = $fcb->open(@date); + for ($count = 0; $count < $to; ) { + my $ref; if ($fh) { + @in = (); while (<$fh>) { chomp; - push @in, [ split '\^' ]; + $ref = [ split '\^' ]; + push @{$ref}, "" unless @{$ref} >= 4; + push @in, $ref; } eval $eval; # do the search on this file - return ("Spot search error", $@) if $@; + last if $count >= $to; # stop after n + return ("Log search error", $@) if $@; } - $fh = $self->openprev(); # get the next file + $fh = $fcb->openprev(); # get the next file last if !$fh; } - + return @out; }