diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-07-21 23:18:44 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-07-21 23:44:17 -0700 |
commit | 7ffa7e7540d4523072b049e2d1285c34faabeeb9 (patch) | |
tree | d071fe530bd6712b5576ac342d3087e4a9fac0ac /pp.c | |
parent | abcb810c88ac3af57afe0fd06c1c339f104b10f9 (diff) | |
download | perl-7ffa7e7540d4523072b049e2d1285c34faabeeb9.tar.gz |
Don’t call get-magic twice for sym refs
Dereferencing ops (${}, etc.) were calling get-magic on their operand
twice if it was a symbolic reference, except for &{}.
This commit fixes that, adding tests for all the deref ops, including
&{}, for good measure.
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -219,7 +219,15 @@ PP(pp_rv2gv) things. */ RETURN; } - sv = MUTABLE_SV(gv_fetchsv(sv, GV_ADD, SVt_PVGV)); + { + STRLEN len; + const char * const nambeg = SvPV_nomg_const(sv, len); + sv = MUTABLE_SV( + gv_fetchpvn_flags( + nambeg, len, GV_ADD | SvUTF8(sv), SVt_PVGV + ) + ); + } } /* FAKE globs in the symbol table cause weird bugs (#77810) */ if (sv) SvFAKE_off(sv); @@ -281,7 +289,9 @@ Perl_softref2xv(pTHX_ SV *const sv, const char *const what, } } else { - gv = gv_fetchsv(sv, GV_ADD, type); + STRLEN len; + const char * const nambeg = SvPV_nomg_const(sv, len); + gv = gv_fetchpvn_flags(nambeg, len, GV_ADD | SvUTF8(sv), type); } return gv; } |