in reply to Re^5: (??{ code }) versus (?PARNO) for recursive regular expressions
in thread (??{ code }) versus (?PARNO) for recursive regular expressions
Thank you for the sanity check. I ran your above statements on strawberry perl v5.12.1
> perl -e"use strict; our $x = $x;" > perl -e"use strict; our $x = qr/(??{ $x })/;" Variable "$x" is not imported at (re_eval 1) line 2. Global symbol "$x" requires explicit package name at (re_eval 1) line +2. Compilation failed in regexp at -e line 1. > perl -e"use strict; my $x = qr/(??{ $x })/;" Global symbol "$x" requires explicit package name at (re_eval 1) line +2. Compilation failed in regexp at -e line 1.
And on perl v5.10.0 built for i686-linux
$ perl -e'use strict; our $x=$x;' $ perl -e'use strict; our $x=qr/(??{ $x })/;' Variable "$x" is not imported at (re_eval 1) line 2. Global symbol "$x" requires explicit package name at (re_eval 1) line +2. Compilation failed in regexp at -e line 1. $ perl -e'use strict; my $x = qr/(??{ $x })/;' Global symbol "$x" requires explicit package name at (re_eval 1) line +2. Compilation failed in regexp at -e line 1.
However, done on perl v5.8.0 built for i386-linux-thread-multi, I get no strictures errors and the original parsing code works as desired.:
$ perl -e'use strict; our $x = $x' $ perl -e'use strict; our $x = qr/(??{ $x })/;' $ perl -e'use strict; my $x = qr/(??{ $x })/;'
So this change to the way (??{ code }) was validated for strictures changed at least after v5.8.0. Maybe this was done when (?PARNO) was introduced in v5.10.0. I guess that's one way to encourage people to move to a new feature. Gotta say it's still annoying though.
Update: Added data on my declarations using (??{ code }) per ikegami's request.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: (??{ code }) versus (?PARNO) for recursive regular expressions
by ikegami (Patriarch) on Mar 26, 2011 at 02:49 UTC | |
by wind (Priest) on Mar 26, 2011 at 03:32 UTC | |
by ikegami (Patriarch) on Mar 26, 2011 at 03:48 UTC |