diff options
author | Nicholas Clark <nick@ccl4.org> | 2012-09-23 22:48:42 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2012-09-26 23:28:50 +0200 |
commit | dc93d7fb33f6b20933ff809c56ba68b8513d02c8 (patch) | |
tree | c53760b75fc758da8609351c9a90ac0b729e6efc /sv.c | |
parent | b3ebc22146bca162c8b7f92453024f9f7a965c0a (diff) | |
download | perl-dc93d7fb33f6b20933ff809c56ba68b8513d02c8.tar.gz |
Flush PL_stashcache when assigning a file handle to a typeglob.
File handles take priority over stashes for method dispatch. Assigning a
file handle to a typeglob potentially creates a file handle where one did
not exist before. As PL_stashcache only contains entries for names which
unambiguously resolve to stashes, such a change may mean that PL_stashcache
now contains an invalid entry. As it's hard to work out exactly which entries
might be affected, simply flush the entire cache and let it rebuild itself.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -3883,6 +3883,14 @@ S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr) assert(mg); Perl_magic_clearisa(aTHX_ NULL, mg); } + else if (stype == SVt_PVIO) { + DEBUG_o(Perl_deb(aTHX_ "glob_assign_ref clearing PL_stashcache\n")); + /* It's a cache. It will rebuild itself quite happily. + It's a lot of effort to work out exactly which key (or keys) + might be invalidated by the creation of the this file handle. + */ + hv_clear(PL_stashcache); + } break; } SvREFCNT_dec(dref); |