summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-02-22 15:19:34 +0000
committerNicholas Clark <nick@ccl4.org>2011-02-22 15:19:34 +0000
commitccdda9cbebc935188ca88f492ce8739de41d890a (patch)
tree97e8f6073c2c97e495690a6f5435de8aafd95714 /gv.c
parente638587ce5c7e6f5bb569dca7be9a47a83a97b9d (diff)
downloadperl-ccdda9cbebc935188ca88f492ce8739de41d890a.tar.gz
Avoid loading modules for %! and %+ on meeting %{"foo::!"} and %{"foo::+"}
Previously, just %{"foo::!"} would not trigger a load of Errno, but ${"foo::!"}; %{"foo::!"}; would, due to the different code paths taken through Perl_gv_fetchpvn_flags(). As the modules themselves are responsible for calling tie on the relevant global variables, there never was a problem with the wrong variables *getting* their behaviour. However, the attempted load of the XS module Tie::Hash::NamedCapture for %{"foo::-} meant that t/op/leaky-magic.t would not pass under minitest. This commit resolves that failure.
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gv.c b/gv.c
index 5ddfb563e8..f4176865a2 100644
--- a/gv.c
+++ b/gv.c
@@ -1239,7 +1239,8 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
if (add) {
GvMULTI_on(gv);
gv_init_sv(gv, sv_type);
- if (len == 1 && (sv_type == SVt_PVHV || sv_type == SVt_PVGV)) {
+ if (len == 1 && stash == PL_defstash
+ && (sv_type == SVt_PVHV || sv_type == SVt_PVGV)) {
if (*name == '!')
require_tie_mod(gv, "!", newSVpvs("Errno"), "TIEHASH", 1);
else if (*name == '-' || *name == '+')