+ if ($pattern) {
+ $hint = qq{m{\Q$pattern\E}i};
+ } else {
+ $hint = q{!m{\^(?:ann|rcmd|talk|chat)\^}};
+ }
+ if ($who) {
+ $hint .= ' && ' if $hint;
+ $hint .= q{m{\Q$who\E}i};
+ }
+ $hint = "next unless $hint" if $hint;
+ $hint .= "; next unless m{^\\d+\\^$pattern\\^}i" if $pattern;
+ $hint ||= "";
+
+ $eval = qq(while (<\$fh>) {
+ $hint;
+ chomp;
+ # say "line: \$_";
+ push \@in, \$_;
+ last L1 if \@in >= $tot;
+ } );
+
+ if (isdbg('search')) {
+ dbg("sh/log hint: $hint");
+ dbg("sh/log eval: $eval");
+ }
+
+ $fcb->close; # close any open files
+
+ my $months;
+ my $fh;
+ if ($readback) {
+ my $fn = $fcb->fn($jdate);
+ $fh = IO::File->new("$readback $fn |");
+ } else {
+ $fh = $fcb->open($jdate);
+ }
+ L1: for ($months = 0; $fh && $months < $maxmonths && @in < $tot; $months++) {
+ my $ref;