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.
In reply to Re^6: (??{ code }) versus (?PARNO) for recursive regular expressions
by wind
in thread (??{ code }) versus (?PARNO) for recursive regular expressions
by wind
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |