Subject: | [Patch] Test cases and using modules emit lots of noise under perls >5.10 |
Under perls 5.10 and greater, any program requiring Handlers.pm causes a
warning notice to be emitted,
t/01simple......Variable "$nest" is not available at (re_eval 2) line 2.
Variable "$nest" is not available at (re_eval 3) line 2.
This can be extremely annoying. All the test cases I've looked at for
Show quoted text
>5.10 show this behaviour.
5.11: ( Problem )
http://www.nntp.perl.org/group/perl.cpan.testers/2007/12/msg877280.html
5.10: ( Problem )
http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg623315.html
5.8 : ( No Problem )
http://www.nntp.perl.org/group/perl.cpan.testers/2008/11/msg2591886.html
This appears to stem from the use of $name = qr[(??{ $name })] code,
which can be also a bit hard to understand.
Attached is the same qr[] blocks re-written using perl5.10's named
references, which quietens down the problem a little.
Subject: | Regexp-Parser-0.20-perl510reg.patch |
diff -Naur Regexp-Parser-0.20/lib/Regexp/Parser/Handlers.pm Regexp-Parser-0.20/lib/Regexp/Parser/Handlers.pm
--- Regexp-Parser-0.20/lib/Regexp/Parser/Handlers.pm 2004-07-07 01:38:26.000000000 +1200
+++ Regexp-Parser-0.20/lib/Regexp/Parser/Handlers.pm 2009-01-02 21:59:05.960525624 +1300
@@ -697,7 +697,21 @@
$self->add_handler('(?{' => sub {
my ($S) = @_;
my $nest;
- $nest = qr[ (?> [^\\{}]+ | \\. | { (??{ $nest }) } )* ]x;
+ $nest = qr[
+ (?<recursion> # Named Capture Group
+ (?> # No BackTrack
+ [^\\{}]+ # No slash or braces
+ | # Or
+ \\. # Slash Dot
+ | # Or
+ { # Open Brace
+ (?&recursion) # Recurse Into this code again
+ } # Close Brace
+ )* # Repeated 0 or more times
+ ) # End Named Capture
+ ]x;
+
+# $nest = qr[ (?> [^\\{}]+ | \\. | { (??{ $nest }) } )* ]x;
if (${&Rx} =~ m{ \G ($nest) \} \) }xgc) {
push @{ $S->{flags} }, &Rf;
return $S->object(eval => $1);
@@ -722,7 +736,20 @@
$self->add_handler('(??{' => sub {
my ($S) = @_;
my $nest;
- $nest = qr[ (?> [^\\{}]+ | \\. | { (??{ $nest }) } )* ]x;
+ $nest = qr[
+ (?<recursion> # Named Capture Group
+ (?> # No BackTrack
+ [^\\{}]+ # No slash or braces
+ | # Or
+ \\. # Slash Dot
+ | # Or
+ { # Open Brace
+ (?&recursion) # Recurse Into this code again
+ } # Close Brace
+ )* # Repeated 0 or more times
+ ) # End Named Capture
+ ]x;
+
if (${&Rx} =~ m{ \G ($nest) \} \) }xgc) {
push @{ $S->{flags} }, &Rf;
return $S->object(logical => $1);