my $self = shift;
weaken $self;
Filter::Keyword::Parser->new(
- reader => sub { my $r = filter_read; ($_, $r) },
+ reader => sub { $_ = ''; my $r = filter_read; ($_, $r) },
re_add => sub { filter_add($self) },
);
}
sub match_source {
my ($self, $first, $second) = @_;
- $self->fetch_more while $self->code =~ /$first\s+\Z/;
- if (my @match = ($self->code =~ /(.*?${first}\s+${second})(.*)\Z/)) {
- $self->code(pop @match);
+ $self->fetch_more while $self->code =~ /\A$first\s+\z/;
+ if (my @match = ($self->code =~ /(.*?${first}\s+${second})(.*\n?)\z/)) {
+ my $code = pop @match;
+ $self->code($code);
my $found = shift(@match);
return ($found, \@match);
}
) {
my $sub = sub {};
set_prototype(\&$sub, '*;@') unless $matches->[0] eq '(';
- { no warnings 'redefine', 'prototype'; *{$keyword->globref} = $sub; }
+ { no warnings 'redefine'; *{$keyword->globref} = $sub; }
$keyword->save_refcount;
$self->current_match($matches);
$self->short_circuit(1);