Subject: | quotelike filters fail on $foo-> arguments |
Date: | Mon, 17 Aug 2009 11:59:55 +0100 |
To: | bug-Filter-Simple [...] rt.cpan.org |
From: | Andrew Suffield <asuffield [...] suffields.me.uk> |
The following doesn't work, with no obvious "ambiguous parsing"
reasons:
---8<---
use Filter::Simple::FilterOnlyQuotelikeTest qr/not ok/ => "ok";
my $i = sub { print "$_[0]\n" };
$i->("not ok 11");
---8<---
Where the filter is the one from t/lib/ with 'string' changed to
'quotelike'. Hence, it's supposed to be mangling the quoted string.
---8<---
package Filter::Simple::FilterOnlyQuotelikeTest;
use Filter::Simple;
FILTER_ONLY
quotelike => sub {
my $class = shift;
while (my($pat, $str) = splice @_, 0, 2) {
s/$pat/$str/g;
}
};
---8<---
A quick investigation indicates that Text::Balanced is not considering
the string to be a match, because extract_variable is greedily
consuming the whole function call, so the arguments are not available
for further matching. It's not apparent why this is being used here
and not in string matches - I would expect the two to be almost
identical, and vary only in what is passed to the filter, not what
they match.