projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added iscallsign regexes
[spider.git]
/
perl
/
DXLogPrint.pm
diff --git
a/perl/DXLogPrint.pm
b/perl/DXLogPrint.pm
index fff39d1256894e6a1765249f0ac157d85fa65b0a..b287413da9a511d7e5cb8e3863889c0228bde6d9 100644
(file)
--- a/
perl/DXLogPrint.pm
+++ b/
perl/DXLogPrint.pm
@@
-8,7
+8,7
@@
package DXLog;
package DXLog;
-use
FileHand
le;
+use
IO::Fi
le;
use DXVars;
use DXDebug ();
use DXUtil;
use DXVars;
use DXDebug ();
use DXUtil;
@@
-25,18
+25,22
@@
use strict;
#
sub print
{
#
sub print
{
- my $
self
= $DXLog::log;
+ my $
fcb
= $DXLog::log;
my $from = shift;
my $to = shift;
my $from = shift;
my $to = shift;
- my @date =
$self->unixtoj
(shift);
+ my @date =
Julian::unixtojm
(shift);
my $pattern = shift;
my $pattern = shift;
+ my $who = uc shift;
my $search;
my @in;
my $search;
my @in;
- my @out;
+ my @out
= ()
;
my $eval;
my $count;
my $eval;
my $count;
- $search = $pattern ? "\$ref->[1] =~ /$pattern/" : '1' ;
+ $search = '1' unless $pattern || $who;
+ $search = "\$ref->[1] =~ /$pattern/" if $pattern;
+ $search .= ' && ' if $pattern && $who;
+ $search .= "(\$ref->[2] =~ /$who/ || \$ref->[3] =~ /$who/)" if $who;
$eval = qq(
my \$c;
my \$ref;
$eval = qq(
my \$c;
my \$ref;
@@
-46,29
+50,32
@@
sub print
\$count++;
next if \$count < $from;
push \@out, print_item(\$ref);
\$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) {
if ($fh) {
+ @in = ();
while (<$fh>) {
chomp;
while (<$fh>) {
chomp;
- push @in, [ split '\^' ];
+ $ref = [ split '\^' ];
+ push @{$ref}, "" unless @{$ref} >= 4;
+ push @in, $ref;
}
eval $eval; # do the search on this file
}
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;
}
last if !$fh;
}
-
+
return @out;
}
return @out;
}
@@
-98,7
+105,7
@@
sub print_item
} elsif ($ref[1] eq 'talk') {
$s = "$ref[3] -> $ref[2] ($ref[4]) $ref[5]";
} elsif ($ref[1] eq 'ann') {
} elsif ($ref[1] eq 'talk') {
$s = "$ref[3] -> $ref[2] ($ref[4]) $ref[5]";
} elsif ($ref[1] eq 'ann') {
- $s = "$ref[
2] -> $ref[3
] $ref[4]";
+ $s = "$ref[
3] -> $ref[2
] $ref[4]";
} else {
$s = "$ref[2]";
}
} else {
$s = "$ref[2]";
}