diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-10-02 22:38:27 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-11 00:10:15 -0700 |
commit | d39c26a657753cddffc8cb3dbd2aaa929b2c78fe (patch) | |
tree | e3061d7ad6cb247565e7ce16a74db2eddc5a07e7 /mg.c | |
parent | 5a36b2c090849e18b86c1759887c5bcebd598113 (diff) | |
download | perl-d39c26a657753cddffc8cb3dbd2aaa929b2c78fe.tar.gz |
foreach \$var
Some passing tests are still marked to-do. We need more tests still.
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -2507,7 +2507,14 @@ Perl_magic_setlvref(pTHX_ SV *sv, MAGIC *mg) hv_store_ent((HV *)mg->mg_obj, (SV *)mg->mg_ptr, SvREFCNT_inc_simple_NN(SvRV(sv)), 0); } - sv_unmagic(sv, PERL_MAGIC_lvref); + if (mg->mg_flags & MGf_PERSIST) + NOOP; /* This sv is in use as an iterator var and will be reused, + so we must leave the magic. */ + else + /* This sv could be returned by the assignment op, so clear the + magic, as lvrefs are an implementation detail that must not be + leaked to the user. */ + sv_unmagic(sv, PERL_MAGIC_lvref); return 0; } |