diff options
author | Simon Cozens <simon@netthink.co.uk> | 2000-12-11 01:21:45 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-11 15:02:21 +0000 |
commit | 1f5346dc23a1f0ea577a0a8dfa3e9472d228092d (patch) | |
tree | deeabe58826d73e4f76cab80c9c051a8dd95f1bc /pp_hot.c | |
parent | 400728b860602b352de8071deef81019cfa0d73e (diff) | |
download | perl-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.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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); |