Subject: | $MATCH var no longer visible in grammar syntax |
Take this otherwise slightly contrived code:
use strict;
use warnings;
use Regexp::Grammars;
my $grammar = qr{
"
<[MATCH=(.)]>+
"
<MATCH=(?{ join q[], @{$MATCH} })>
}x;
use Data::Dumper qw(Dumper);
if( q["helloworld"] =~ $grammar ) {
print Dumper( \%/ );
}
On 1.042 , this code executes as expected without error.
On 1.043, this code fails with
---
Global symbol "$MATCH" requires explicit package name (did you forget to declare "my $MATCH"?) at /tmp/reg.pl line 10.
---
Explicitly declaring "our $MATCH" before the `my $grammar` does indeed resolve the issue, but it was not documented in 1.043's changes that this was to be expected.
If I had to guess why its not working as expected, I'd say the change to using `vars.pm` to create those vars may be importing them into the wrong package.
( seeing vars.pm uses caller() and not compile-context, https://metacpan.org/source/RJBS/perl-5.22.0/lib/vars.pm#L11 , and given I cant see anything that would change what caller reported in R:G:import