summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-01 21:17:46 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-01 21:17:46 +0000
commit5b9c067131ee63b4afa00d1d71c771377deb6ff9 (patch)
treef0d23e7597d8b97766a275feb1effc1c8360e3bb /scope.c
parentdef9038f0e6b68e6331316ef6cd457a2bf75dab6 (diff)
downloadperl-5b9c067131ee63b4afa00d1d71c771377deb6ff9.tar.gz
Automatically set HINT_LOCALIZE_HH whenever %^H is modified.
p4raw-id: //depot/perl@27666
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/scope.c b/scope.c
index 5e4193ac17..b4ecd65967 100644
--- a/scope.c
+++ b/scope.c
@@ -895,8 +895,28 @@ Perl_leave_scope(pTHX_ I32 base)
if (PL_hints & HINT_LOCALIZE_HH) {
SvREFCNT_dec((SV*)GvHV(PL_hintgv));
GvHV(PL_hintgv) = (HV*)SSPOPPTR;
+ assert(GvHV(PL_hintgv));
+ } else if (!GvHV(PL_hintgv)) {
+ /* Need to add a new one manually, else gv_fetchpv() can
+ add one in this code:
+
+ if (SvTYPE(gv) == SVt_PVGV) {
+ if (add) {
+ GvMULTI_on(gv);
+ gv_init_sv(gv, sv_type);
+ if (*name=='!' && sv_type == SVt_PVHV && len==1)
+ require_errno(gv);
+ }
+ return gv;
+ }
+
+ and it won't have the magic set. */
+
+ HV *const hv = newHV();
+ hv_magic(hv, NULL, PERL_MAGIC_hints);
+ GvHV(PL_hintgv) = hv;
}
-
+ assert(GvHV(PL_hintgv));
break;
case SAVEt_COMPPAD:
PL_comppad = (PAD*)SSPOPPTR;