This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[proposed PATCH] correctly unlocalise exists on tied/%ENV
authorDave Mitchell <davem@fdisolutions.com>
Sat, 4 May 2002 00:34:18 +0000 (01:34 +0100)
committerJarkko Hietaniemi <jhi@iki.fi>
Mon, 6 May 2002 13:13:00 +0000 (13:13 +0000)
Message-ID: <20020504003418.F22026@fdgroup.com>

p4raw-id: //depot/perl@16431

pp_hot.c
t/op/local.t

index 30653a7..f2387b4 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1644,7 +1644,12 @@ PP(pp_helem)
 
     if (SvTYPE(hv) == SVt_PVHV) {
        if (PL_op->op_private & OPpLVAL_INTRO)
-           preeminent = SvRMAGICAL(hv) ? 1 : hv_exists_ent(hv, keysv, 0);
+           preeminent =  
+               ( SvRMAGICAL(hv)
+                 && !mg_find((SV*)hv, PERL_MAGIC_tied)
+                 && !mg_find((SV*)hv, PERL_MAGIC_env)
+               ) ? 1 : hv_exists_ent(hv, keysv, 0);
+
        he = hv_fetch_ent(hv, keysv, lval && !defer, hash);
        svp = he ? &HeVAL(he) : 0;
     }
index 9f977b2..d23b200 100755 (executable)
@@ -130,6 +130,7 @@ print +(!defined $a[0]) ? "" : "not ", "ok 41\n";
     sub TIEHASH { bless {}, $_[0] }
     sub STORE { print "# STORE [@_]\n"; $_[0]->{$_[1]} = $_[2] }
     sub FETCH { my $v = $_[0]->{$_[1]}; print "# FETCH [@_=$v]\n"; $v }
+    sub EXISTS { print "# EXISTS [@_]\n"; exists $_[0]->{$_[1]}; }
     sub DELETE { print "# DELETE [@_]\n"; delete $_[0]->{$_[1]}; }
     sub CLEAR { print "# CLEAR [@_]\n"; %{$_[0]} = (); }
 }