summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2009-08-21 01:49:14 +0200
committerVincent Pit <perl@profvince.com>2009-08-21 13:33:59 +0200
commitf747ebd621ca5f8cd5605b35b81db4ac486f68f9 (patch)
treee412ad370ee591c40096e9d87a3aa30ac7b6b269 /cop.h
parenta8ae8fee103e29c80450bb74b87866088a24b4a1 (diff)
downloadperl-f747ebd621ca5f8cd5605b35b81db4ac486f68f9.tar.gz
Add clear magic to %^H so that the HE chain is reset when you empty it.
This fixes [perl #68590] : %^H not lexical enough.
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h13
1 files changed, 9 insertions, 4 deletions
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