summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorSimon Cozens <simon@netthink.co.uk>2000-12-11 01:21:45 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-12-11 15:02:21 +0000
commit1f5346dc23a1f0ea577a0a8dfa3e9472d228092d (patch)
treedeeabe58826d73e4f76cab80c9c051a8dd95f1bc /pp_hot.c
parent400728b860602b352de8071deef81019cfa0d73e (diff)
downloadperl-1f5346dc23a1f0ea577a0a8dfa3e9472d228092d.tar.gz
Re: [Fwd: BUG 20001205.022] Local on Hash elements
Message-ID: <20001211012144.A23467@deep-dark-truthful-mirror.perlhacker.org> p4raw-id: //depot/perl@8077
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 979d1111a0..2dedcddf70 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1532,8 +1532,11 @@ PP(pp_helem)
U32 defer = PL_op->op_private & OPpLVAL_DEFER;
SV *sv;
U32 hash = (SvFAKE(keysv) && SvREADONLY(keysv)) ? SvUVX(keysv) : 0;
+ I32 preeminent;
if (SvTYPE(hv) == SVt_PVHV) {
+ if (PL_op->op_private & OPpLVAL_INTRO)
+ preeminent = SvRMAGICAL(hv) ? 1 : hv_exists_ent(hv, keysv, 0);
he = hv_fetch_ent(hv, keysv, lval && !defer, hash);
svp = he ? &HeVAL(he) : 0;
}
@@ -1566,8 +1569,14 @@ PP(pp_helem)
if (PL_op->op_private & OPpLVAL_INTRO) {
if (HvNAME(hv) && isGV(*svp))
save_gp((GV*)*svp, !(PL_op->op_flags & OPf_SPECIAL));
- else
- save_helem(hv, keysv, svp);
+ else {
+ if (!preeminent) {
+ STRLEN keylen;
+ char *key = SvPV(keysv, keylen);
+ save_delete(hv, key, keylen);
+ } else
+ save_helem(hv, keysv, svp);
+ }
}
else if (PL_op->op_private & OPpDEREF)
vivify_ref(*svp, PL_op->op_private & OPpDEREF);