diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2007-09-09 19:51:50 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2007-09-09 19:51:50 +0000 |
commit | a74073ad6436c46fca5196ffa4ea01684b55afc4 (patch) | |
tree | 1a7ba237b7c773bd3173c7b167bcbabd984a8bb3 /op.c | |
parent | bbe8372978680ed3788dc9752a23b00b0bca8736 (diff) | |
download | perl-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.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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; } |