polyze/Polyze/H2Late.pm

30 lines
925 B
Perl

package Polyze::H2Late;
use Moose;
with 'Polyze::Handler';
sub scan_line {
my ($self, $line) = @_;
my $is_past_day = ($line->text !~ $self->day_regex);
return do {
if (! $is_past_day) {
# Nothing to see here, let the other handlers do their things.
$Polyze::CONTINUE_LINE;
} else {
# The work of any within-day handler is done since we are now
# past that day. So remove all handlers (including self)
# except those specifically intended for post-day scanning.
my @retirees =
grep { ! $_->isa_post_day_handler; } @{$self->polyze->handlers};
for my $r (@retirees) {
$self->polyze->remove_handler($r);
}
# Now that we've adjusted the handlers, redo the log line in
# order to apply that adjustment.
$Polyze::REDO_LINE;
}
};
}
no Moose;
__PACKAGE__->meta->make_immutable;