This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
handle weird/undef (?{}), (??{}) return value
authorDavid Mitchell <davem@iabyn.com>
Mon, 4 Jun 2012 12:24:23 +0000 (13:24 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 13 Jun 2012 12:32:55 +0000 (13:32 +0100)
commite4bfbed39bdcbc5cd76c9cdfdeb3314c3710ad62
tree65692813c4e3da4c86143f350fd4828ca4173064
parent9753d9401c87ce7ed5fdc20d64992a62f60942a7
handle weird/undef (?{}), (??{}) return value

All three code block variants: (?{}), (??{}), (?(?{}X|Y)),
make use of the return value of the block, either to set $^R, determine
truth, or to interpret as a pattern.  Evaluating this value may trigger
magic calls, uninitialized var warnings etc. Make sure that this
processing happens in the right environment; specifically, before we've
restored vars and paren indices, and we set PL_op temporarily to NULL so
that uninit var warnings don't try to look in the wrong place: neither the
outer op (eg OP_MATCH) nor the inner op (the last op of the code block:
currently happens to be OP_NULL, but that's a bug; will eventually be last
*real* op, e.g. padsv) are suitable for identifying where the warning came
from.

For the (??{}) case, if we can't extract a pre-compiled regex from it,
we force it to a PV, making a temp copy if necessary.
regexec.c
t/re/pat_re_eval.t