From f747ebd621ca5f8cd5605b35b81db4ac486f68f9 Mon Sep 17 00:00:00 2001 From: Zefram Date: Fri, 21 Aug 2009 01:49:14 +0200 Subject: Add clear magic to %^H so that the HE chain is reset when you empty it. This fixes [perl #68590] : %^H not lexical enough. --- cop.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'cop.h') diff --git a/cop.h b/cop.h index fc19494e25..3633e9d353 100644 --- a/cop.h +++ b/cop.h @@ -246,12 +246,17 @@ struct cop { #define CopARYBASE_set(c, b) STMT_START { \ if (b || ((c)->cop_hints & HINT_ARYBASE)) { \ (c)->cop_hints |= HINT_ARYBASE; \ - if ((c) == &PL_compiling) \ - PL_hints |= HINT_LOCALIZE_HH | HINT_ARYBASE; \ - (c)->cop_hints_hash \ - = Perl_refcounted_he_new(aTHX_ (c)->cop_hints_hash, \ + if ((c) == &PL_compiling) { \ + SV *val = newSViv(b); \ + (void)hv_stores(GvHV(PL_hintgv), "$[", val); \ + mg_set(val); \ + PL_hints |= HINT_ARYBASE; \ + } else { \ + (c)->cop_hints_hash \ + = Perl_refcounted_he_new(aTHX_ (c)->cop_hints_hash, \ newSVpvs_flags("$[", SVs_TEMP), \ sv_2mortal(newSViv(b))); \ + } \ } \ } STMT_END -- cgit v1.2.1