summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-12-10 16:42:52 -0600
committerJesse Luehrs <doy@tozt.net>2011-12-10 16:42:52 -0600
commit7ce1a95bcdc70373d59d14302951ac0c334d5fe0 (patch)
tree311cbfdad666d8734ea7325ea356a60523a19a18
parente006ab793e155668184c71836c2d69a8eeac9757 (diff)
downloadpackage-stash-xs-7ce1a95bcdc70373d59d14302951ac0c334d5fe0.tar.gz
package-stash-xs-7ce1a95bcdc70373d59d14302951ac0c334d5fe0.zip
apply magic properly when initializing globs
-rw-r--r--XS.xs25
1 files changed, 25 insertions, 0 deletions
diff --git a/XS.xs b/XS.xs
index d131115..59f6b79 100644
--- a/XS.xs
+++ b/XS.xs
@@ -332,6 +332,31 @@ static void _real_gv_init(GV *gv, HV *stash, SV *name)
name_pv = SvPV(name, name_len);
gv_init(gv, stash, name_pv, name_len, 1);
+
+ /* XXX: copied and pasted from gv_fetchpvn_flags and such */
+ /* ignoring the stuff for CORE:: and main:: for now, and also
+ * ignoring the GvMULTI_on bits, since we pass 1 to gv_init above */
+ switch (name_pv[0]) {
+ case 'I':
+ if (strEQ(&name_pv[1], "SA")) {
+ AV *av;
+
+ av = GvAVn(gv);
+ sv_magic(MUTABLE_SV(av), MUTABLE_SV(gv), PERL_MAGIC_isa,
+ NULL, 0);
+ }
+ break;
+ case 'O':
+ if (strEQ(&name_pv[1], "VERLOAD")) {
+ HV *hv;
+
+ hv = GvHVn(gv);
+ hv_magic(hv, NULL, PERL_MAGIC_overload);
+ }
+ break;
+ default:
+ break;
+ }
}
static void _expand_glob(SV *self, SV *varname)