summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-12-07 18:02:16 -0800
committerFather Chrysostomos <sprout@cpan.org>2010-12-07 18:03:12 -0800
commit558b442404962caba5a81ad5b785fef3cf5eac5d (patch)
treeb23e9298591a9090bd811294da6d1546155f44da /t
parent1af910ea8358b80143d7e7c877436232e1fde3ec (diff)
downloadperl-558b442404962caba5a81ad5b785fef3cf5eac5d.tar.gz
[perl #66104] Bugs in extended regexp features
More precisely: Make run-time (?{...}) inherit pragmata. This commit makes Perl_sv_compile_2op_is_broken (nice name!) copy the hints from PL_curcop if invoked during run time. Usually they are inherited from the code that is currently being compiled (which works for $foo =~ /(?{...})/), but the code currently being compiled is not the enclosing scope at run time ($bar = '(?{...})'; $foo =~ $bar), hence the need for copying in a similar manner to pp_entereval. Theoretically this code should also have to avoid copying a statement label, but goto inside a regexp eval does not currently work, so I cannot prove or disprove that yet.
Diffstat (limited to 't')
-rw-r--r--t/re/reg_eval_scope.t3
1 files changed, 2 insertions, 1 deletions
diff --git a/t/re/reg_eval_scope.t b/t/re/reg_eval_scope.t
index 8c8be6a6c6..bd9ef84575 100644
--- a/t/re/reg_eval_scope.t
+++ b/t/re/reg_eval_scope.t
@@ -104,13 +104,14 @@ off;
"ba" =~ /${\'(?{ $::pack = __PACKAGE__ })a'}/;
}
is $pack, 'bar', '/$text/ containing (?{}) inherits package';
-on;
{
use re 'eval', "/m";
"ba" =~ /${\'(?{ $::re = qr -- })a'}/;
}
is $re, '(?^m:)', '/$text/ containing (?{}) inherits pragmata';
+on;
+
fresh_perl_is <<'CODE', 'ok', { stderr => 1 }, '(?{die})';
eval { "a" =~ /(?{die})a/ }; print "ok"
CODE