summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-09-06 12:16:23 +0100
committerDavid Mitchell <davem@iabyn.com>2011-09-06 12:21:21 +0100
commit87e4a53a894984d98bc11df391f89db73212de5e (patch)
tree9e5b6b48af12325ae3c37f035c35f24438d8c2a0 /pp_ctl.c
parentf5f19483eb9a5629cd2db0902731ca0b471e0adc (diff)
downloadperl-87e4a53a894984d98bc11df391f89db73212de5e.tar.gz
RT #4682: given() didn't scope $_ correctly
given(expr) {...} behaves similarly to { my $_ = expr; ...}, except that, prior to this commit, it wasn't doing the SAVECLEARSV() that pp_padsv would do. This meant that $_ was still marked as stale while in scope, and wasn't getting cleared at the end of scope.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 0d2aae1639..238f230116 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -4367,6 +4367,7 @@ PP(pp_entergiven)
ENTER_with_name("given");
SAVETMPS;
+ SAVECLEARSV(PAD_SVl(PL_op->op_targ));
sv_setsv_mg(PAD_SV(PL_op->op_targ), POPs);
PUSHBLOCK(cx, CXt_GIVEN, SP);