sub inject_after_scope {
my $inject = shift;
+ my $parser = $Filter::Keyword::Filter::ACTIVE_FILTERS[-1]->parser;
+
on_scope_end {
- filter_add(sub {
- DEBUG && print $inject;
- $_ = $inject;
- filter_del;
- 1;
- });
+ my $code = $parser->code;
+ $parser->code($inject . $code);
};
}
sub match_source {
my ($self, $first, $second) = @_;
$self->fetch_more while $self->code =~ /\A$first\s+\z/;
- if (my @match = ($self->code =~ /(.*?${first}\s+${second})(.*\n?)\z/)) {
+ if (my @match = ($self->code =~ /(.*?${first}\s+${second})((?s).*)\z/)) {
my $code = pop @match;
$self->code($code);
my $found = shift(@match);