Add tests for RT #84294 /((\w+)(?{print $2})){2,2}/ problem
authorYves Orton <demerphq@gmail.com>
Sat, 12 Mar 2011 16:17:22 +0000 (17:17 +0100)
committerYves Orton <demerphq@gmail.com>
Sat, 12 Mar 2011 16:43:46 +0000 (17:43 +0100)
commitd774cd11ba563c66e3199abfc3061bdc88e980e0
tree7c076a0f3751d56edd700cecb1ddd4f1be029da3
parentdeaabfbb31a16ea25dbcf2eeeccec817bd469adf
Add tests for RT #84294 /((\w+)(?{print $2})){2,2}/ problem

Original ticket reports:

    print "Match: \$1=$1 \$2=$2" if 'ab' =~/^((\w+)(?{print defined $2 ? "\$2=$2\n" : "\$2 not defined\n"})){2}$/;

Produces the following incorrect output:

    $2=ab
    $2 not defined
    $2=b
    Match: $1=b $2=b

It should produce:

    $2=ab
    $2=a
    $2=b
    Match: $1=b $2=b

This adds a TODO test to verify this behavior.
t/re/pat.t