summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2007-09-09 19:51:50 +0000
committerDave Mitchell <davem@fdisolutions.com>2007-09-09 19:51:50 +0000
commita74073ad6436c46fca5196ffa4ea01684b55afc4 (patch)
tree1a7ba237b7c773bd3173c7b167bcbabd984a8bb3 /op.c
parentbbe8372978680ed3788dc9752a23b00b0bca8736 (diff)
downloadperl-a74073ad6436c46fca5196ffa4ea01684b55afc4.tar.gz
state variables shouldn't be shared between anon subs
p4raw-id: //depot/perl@31833
Diffstat (limited to 'op.c')
-rw-r--r--op.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/op.c b/op.c
index ca488a279b..1ebc84c325 100644
--- a/op.c
+++ b/op.c
@@ -395,6 +395,12 @@ Perl_allocmy(pTHX_ const char *const name)
0, /* not fake */
PL_parser->in_my == KEY_state
);
+ /* anon sub prototypes contains state vars should always be cloned,
+ * otherwise the state var would be shared between anon subs */
+
+ if (PL_parser->in_my == KEY_state && CvANON(PL_compcv))
+ CvCLONE_on(PL_compcv);
+
return off;
}