applied patch, add new message to perldeta
authorStephen McCamant <smcc@mit.edu>
Tue, 21 Jul 1998 16:12:25 +0000 (11:12 -0500)
committerGurusamy Sarathy <gsar@cpan.org>
Wed, 22 Jul 1998 02:45:55 +0000 (02:45 +0000)
Message-Id: <13749.910.83378.949909@alias-2.pr.mcs.net>
Subject: [PATCH] Band-aid patch for local($avhv->{a})

p4raw-id: //depot/perl@1619

pod/perldelta.pod
pod/perldiag.pod
pp.c
pp_hot.c

index d3fbae5..6213685 100644 (file)
@@ -492,6 +492,13 @@ only with arrays that have a hash reference at index 0.
 (F) The "goto subroutine" call can't be used to jump out of an eval "string".
 (You can use it to jump out of an eval {BLOCK}, but you probably don't want to.)
 
+=item Can't localize pseudo-hash element
+
+(F) You said something like C<local $ar-E<gt>{'key'}>, where $ar is
+a reference to a pseudo-hash.  That hasn't been implemented yet, but
+you can get a similar effect by localizing the corresponding array
+element directly -- C<local $ar-E<gt>[$ar-E<gt>[0]{'key'}]>.
+
 =item Can't use %%! because Errno.pm is not available
 
 (F) The first time the %! hash is used, perl automatically loads the
index 43226e0..5fdeb70 100644 (file)
@@ -697,6 +697,13 @@ lexical variable using "my".  This is not allowed.  If you want to
 localize a package variable of the same name, qualify it with the
 package name.
 
+=item Can't localize pseudo-hash element
+
+(F) You said something like C<local $ar-E<gt>{'key'}>, where $ar is
+a reference to a pseudo-hash.  That hasn't been implemented yet, but
+you can get a similar effect by localizing the corresponding array
+element directly -- C<local $ar-E<gt>[$ar-E<gt>[0]{'key'}]>.
+
 =item Can't locate auto/%s.al in @INC
 
 (F) A function (or method) was called in a package which allows autoload,
diff --git a/pp.c b/pp.c
index 702806d..5e32613 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -2414,6 +2414,9 @@ PP(pp_hslice)
     register I32 lval = PL_op->op_flags & OPf_MOD;
     I32 realhv = (SvTYPE(hv) == SVt_PVHV);
 
+    if (!realhv && PL_op->op_private & OPpLVAL_INTRO)
+       DIE("Can't localize pseudo-hash element");
+
     if (realhv || SvTYPE(hv) == SVt_PVAV) {
        while (++MARK <= SP) {
            SV *keysv = *MARK;
index 823da44..dd4f82b 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1337,6 +1337,8 @@ PP(pp_helem)
        svp = he ? &HeVAL(he) : 0;
     }
     else if (SvTYPE(hv) == SVt_PVAV) {
+       if (PL_op->op_private & OPpLVAL_INTRO)
+           DIE("Can't localize pseudo-hash element");
        svp = avhv_fetch_ent((AV*)hv, keysv, lval && !defer, 0);
     }
     else {