Fix /a++(?{})+$code_block/
authorFather Chrysostomos <sprout@cpan.org>
Thu, 1 Nov 2012 21:49:35 +0000 (14:49 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 2 Nov 2012 01:10:00 +0000 (18:10 -0700)
commit99543f15a007c8878501777ac5d75c1bbaef03b4
tree1160edc73414f7ad13d957b8b67798bfe9d4d4e5
parent24044fabd839afe7d01d53cc50f06415298d31ec
Fix /a++(?{})+$code_block/

This I would expect:

$ perl5.16.0 -wMre=eval -e '$x = "(?{})"; /a++(?{})+$x/x'
(?{})+ matches null string many times in regex; marked by <-- HERE in m/a++(?{})+ <-- HERE (?{})/ at -e line 1.
Use of uninitialized value $_ in pattern match (m//) at -e line 1.

It warns, but it still runs.

This I would not,

$ perl5.17.5 -wMre=eval -e '$x = "(?{})"; /a++(?{})+$x/x'
Nested quantifiers in regex; marked by <-- HERE in m/a++     + <-- HERE (?{})/ at (eval 1) line 1.

were it not for the fact that I know how it works. :-)

To compile the blocks in $x without recompiling the blocks directly
inside /.../, the regexp compiler blanks out the ‘outer’ blocks with
spaces, and compiles qr'a++     +(?{})'x.  But /x can see through
those spaces, resulting in a change in behaviour.  So use under-
scores instead.
regcomp.c
t/re/rxcode.t