From: Jesse Luehrs Date: Mon, 2 May 2011 21:38:42 +0000 (-0500) Subject: use gv_init instead of gv_fetchsv X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dc83f2327e0b3a49520e73ae66458d9cdc077fb0;p=gitmo%2FPackage-Stash-XS.git use gv_init instead of gv_fetchsv this passes our test suite, but makes moose fail pretty hard --- diff --git a/XS.xs b/XS.xs index fc3078a..76be79e 100644 --- a/XS.xs +++ b/XS.xs @@ -271,9 +271,11 @@ static SV *_get_name(SV *self) return ret; } -static void _expand_glob(SV *self, SV *varname) +static void _expand_glob(SV *self, GV *glob, HV *namespace, SV *varname) { SV *name; + char *namepv; + int len; name = newSVsv(_get_name(self)); sv_catpvs(name, "::"); @@ -281,7 +283,9 @@ static void _expand_glob(SV *self, SV *varname) /* can't use gv_init here, because it screws up @ISA in a way that I * can't reproduce, but that CMOP triggers */ - gv_fetchsv(name, GV_ADD, SVt_NULL); + /* gv_fetchsv(name, GV_ADD, SVt_NULL); */ + namepv = SvPV(name, len); + gv_init(glob, namespace, namepv, len, 1); SvREFCNT_dec(name); } @@ -297,8 +301,9 @@ static SV *_get_symbol(SV *self, varspec_t *variable, int vivify) return NULL; glob = (GV*)(HeVAL(entry)); - if (!isGV(glob)) - _expand_glob(self, variable->name); + if (!isGV(glob)) { + _expand_glob(self, glob, namespace, variable->name); + } if (vivify) { switch (variable->type) { @@ -714,7 +719,7 @@ get_all_symbols(self, vartype=VAR_NONE) if (!isGV(gv)) { SV *keysv = newSVpvn(key, len); - _expand_glob(self, keysv); + _expand_glob(self, gv, namespace, keysv); SvREFCNT_dec(keysv); }