diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-08-26 11:10:18 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-08-26 13:16:54 -0700 |
commit | 3da9985538c5eae2dd2de1309b320bc77f757687 (patch) | |
tree | 89b0b2f2c8ae18a78ddc0a5e2d8eaf5eb397372e | |
parent | 858e07c416232a7bc145c8c4da21220a4f0a2cbd (diff) | |
download | perl-3da9985538c5eae2dd2de1309b320bc77f757687.tar.gz |
Croak for \local %{\%foo}
See the previous commit.
When I moved the check for local %$ref earlier, I didn’t move it
early enough.
-rw-r--r-- | pp_hot.c | 6 | ||||
-rw-r--r-- | t/lib/croak/pp_hot | 10 |
2 files changed, 13 insertions, 3 deletions
@@ -777,13 +777,13 @@ PP(pp_rv2av) if (SvTYPE(sv) != type) /* diag_listed_as: Not an ARRAY reference */ DIE(aTHX_ "Not %s reference", is_pp_rv2av ? an_array : a_hash); + else if (PL_op->op_flags & OPf_MOD + && PL_op->op_private & OPpLVAL_INTRO) + Perl_croak(aTHX_ "%s", PL_no_localize_ref); if (PL_op->op_flags & OPf_REF) { SETs(sv); RETURN; } - else if (PL_op->op_flags & OPf_MOD - && PL_op->op_private & OPpLVAL_INTRO) - Perl_croak(aTHX_ "%s", PL_no_localize_ref); else if (PL_op->op_private & OPpMAYBE_LVSUB) { const I32 flags = is_lvalue_sub(); if (flags && !(flags & OPpENTERSUB_INARGS)) { diff --git a/t/lib/croak/pp_hot b/t/lib/croak/pp_hot index 6b59ba7879..bc00a484c6 100644 --- a/t/lib/croak/pp_hot +++ b/t/lib/croak/pp_hot @@ -23,6 +23,16 @@ Can't localize through a reference at - line 1. EXPECT Can't localize through a reference at - line 1. ######## +# NAME \local %$ref + \local %{\%hash} +EXPECT +Can't localize through a reference at - line 1. +######## +# NAME \local @$ref + \local @{\@hash} +EXPECT +Can't localize through a reference at - line 1. +######## # NAME calling undef sub belonging to undef GV my $foosub = \&foo; undef *foo; |