From: Jesse Luehrs Date: Sat, 10 Dec 2011 22:42:52 +0000 (-0600) Subject: apply magic properly when initializing globs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7ce1a95bcdc70373d59d14302951ac0c334d5fe0;p=gitmo%2FPackage-Stash-XS.git apply magic properly when initializing globs --- 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)