diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-02-22 15:19:34 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-02-22 15:19:34 +0000 |
commit | ccdda9cbebc935188ca88f492ce8739de41d890a (patch) | |
tree | 97e8f6073c2c97e495690a6f5435de8aafd95714 /gv.c | |
parent | e638587ce5c7e6f5bb569dca7be9a47a83a97b9d (diff) | |
download | perl-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.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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 == '+') |