summaryrefslogtreecommitdiff
path: root/mg.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 /mg.c
parentdef9038f0e6b68e6331316ef6cd457a2bf75dab6 (diff)
downloadperl-5b9c067131ee63b4afa00d1d71c771377deb6ff9.tar.gz
Automatically set HINT_LOCALIZE_HH whenever %^H is modified.
p4raw-id: //depot/perl@27666
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mg.c b/mg.c
index 615a2739a3..d8f4e0e96c 100644
--- a/mg.c
+++ b/mg.c
@@ -2857,6 +2857,10 @@ Perl_magic_sethint(pTHX_ SV *sv, MAGIC *mg)
it's NULL. If needed for threads, the alternative could lock a mutex,
or take other more complex action. */
+ /* Something changed in %^H, so it will need to be restored on scope exit.
+ Doing this here saves a lot of doing it manually in perl code (and
+ forgetting to do it, and consequent subtle errors. */
+ PL_hints |= HINT_LOCALIZE_HH;
PL_compiling.cop_hints
= Perl_refcounted_he_new(aTHX_ PL_compiling.cop_hints,
(SV *)mg->mg_ptr, newSVsv(sv));
@@ -2876,6 +2880,7 @@ Perl_magic_clearhint(pTHX_ SV *sv, MAGIC *mg)
dVAR;
assert(mg->mg_len == HEf_SVKEY);
+ PL_hints |= HINT_LOCALIZE_HH;
PL_compiling.cop_hints
= Perl_refcounted_he_new(aTHX_ PL_compiling.cop_hints,
(SV *)mg->mg_ptr, &PL_sv_placeholder);