diff options
author | David Mitchell <davem@iabyn.com> | 2010-06-04 23:09:21 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-06-04 23:25:16 +0100 |
commit | 7c75014e4b3bd5ebe368b5d6b981f310525d1389 (patch) | |
tree | 37d8a950c789042c35934433fe70aca8b2377fc8 /pp_hot.c | |
parent | dfae30232f1b277231b0dee813acbeca0b958afd (diff) | |
download | perl-7c75014e4b3bd5ebe368b5d6b981f310525d1389.tar.gz |
fix for RT #8438: $tied->() doesn't call FETCH
pp_entersub checked for ROK *before* calling magic. If the tied scalar
already had ROK set (perhaps from a previous time), then get magic (and
hence FETCH) wasn't called.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 38 |
1 files changed, 12 insertions, 26 deletions
@@ -2726,29 +2726,20 @@ PP(pp_entersub) } break; default: - if (!SvROK(sv)) { + if (sv == &PL_sv_yes) { /* unfound import, ignore */ + if (hasargs) + SP = PL_stack_base + POPMARK; + RETURN; + } + SvGETMAGIC(sv); + if (SvROK(sv)) { + SV * const * sp = &sv; /* Used in tryAMAGICunDEREF macro. */ + tryAMAGICunDEREF(to_cv); + } + else { const char *sym; STRLEN len; - if (sv == &PL_sv_yes) { /* unfound import, ignore */ - if (hasargs) - SP = PL_stack_base + POPMARK; - RETURN; - } - if (SvGMAGICAL(sv)) { - mg_get(sv); - if (SvROK(sv)) - goto got_rv; - if (SvPOKp(sv)) { - sym = SvPVX_const(sv); - len = SvCUR(sv); - } else { - sym = NULL; - len = 0; - } - } - else { - sym = SvPV_const(sv, len); - } + sym = SvPV_nomg_const(sv, len); if (!sym) DIE(aTHX_ PL_no_usym, "a subroutine"); if (PL_op->op_private & HINT_STRICT_REFS) @@ -2756,11 +2747,6 @@ PP(pp_entersub) cv = get_cvn_flags(sym, len, GV_ADD|SvUTF8(sv)); break; } - got_rv: - { - SV * const * sp = &sv; /* Used in tryAMAGICunDEREF macro. */ - tryAMAGICunDEREF(to_cv); - } cv = MUTABLE_CV(SvRV(sv)); if (SvTYPE(cv) == SVt_PVCV) break; |