diff options
author | Father Chrysostomos <sprout@cpan.org> | 2010-10-27 09:44:04 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-10-27 09:45:26 -0700 |
commit | 78b79c7758384edd69ba966d2f0571855acb1117 (patch) | |
tree | 5804749f02e2f3d1440bc78bd3c684d31ff72202 /mro.c | |
parent | 13d356f324d3ac73ad7eb9e627a33e3fa89132ec (diff) | |
download | perl-78b79c7758384edd69ba966d2f0571855acb1117.tar.gz |
Renaming of stashes should not be visible from Perl
Change 35759254 made stashes get renamed when moved around. This had
an unintended consequence: Typeglobs, ref() return values, stringifi-
cation of blessed references and __PACKAGE__ are all affected by this.
This commit makes a new distinction between stashes’ names and effect-
ive names. Stash names are now unaffected when the stashes move
around. Only the effective names are affected. (The apparent presence
of any puns in the previous sentence is purely incidental and most
likely the result of the reader’s inferential propensity.)
To this end a new HvENAME_get macro is introduced, returning the first effective name (what HvNAME_get was returning). (Only one effective
name needs to be in effect at a time.) hv_add_name and hv_delete_name
have been renamed hv_add_ename and hv_delete_ename. hv_name_set is
modified to leave the effective names in place unless the name is
being set to NULL.
These names are now stored in HvAUX as follows: When xhv_name_count is
0, xhv_name is a HEK pointer, containing the name which is also the
effective name. When xhv_name_count is not zero, then xhv_name is a
pointer to an array of HEK pointers. If xhv_name_count is positive,
the first HEK is the name *and* one of the effective names. When
xhv_name_count is negative, the first HEK is the name and subsequent
HEKs are the effective names.
Diffstat (limited to 'mro.c')
-rw-r--r-- | mro.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -786,9 +786,9 @@ Perl_mro_package_moved(pTHX_ HV * const stash, HV * const oldstash, if(PL_stashcache) (void) hv_delete(PL_stashcache, newname, newname_len, G_DISCARD); - hv_name_delete(oldstash, newname, newname_len); + hv_ename_delete(oldstash, newname, newname_len); } - if(stash) hv_name_add(stash, newname, newname_len); + if(stash) hv_ename_add(stash, newname, newname_len); } /* |