summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-06-04 23:09:21 +0100
committerDavid Mitchell <davem@iabyn.com>2010-06-04 23:25:16 +0100
commit7c75014e4b3bd5ebe368b5d6b981f310525d1389 (patch)
tree37d8a950c789042c35934433fe70aca8b2377fc8 /pp_hot.c
parentdfae30232f1b277231b0dee813acbeca0b958afd (diff)
downloadperl-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.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 1a7c13f221..dc2c442445 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -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;