summaryrefslogtreecommitdiffstats
path: root/Stash.xs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-11-14 13:11:55 -0600
committerJesse Luehrs <doy@tozt.net>2010-11-14 13:11:55 -0600
commit60b395a1c2f7efdba256d7886ad86a0a9fb87e9d (patch)
tree88419d07ddd7cbb4e33ad972f75076993018c219 /Stash.xs
parent64b792116c00d04d1e27f3dbf68e5bca00b30ec6 (diff)
downloadpackage-stash-xs-60b395a1c2f7efdba256d7886ad86a0a9fb87e9d.tar.gz
package-stash-xs-60b395a1c2f7efdba256d7886ad86a0a9fb87e9d.zip
factor out glob expanding into a helper function
Diffstat (limited to 'Stash.xs')
-rw-r--r--Stash.xs28
1 files changed, 16 insertions, 12 deletions
diff --git a/Stash.xs b/Stash.xs
index 9c61138..41d9c0c 100644
--- a/Stash.xs
+++ b/Stash.xs
@@ -285,6 +285,20 @@ SV *_get_name(SV *self)
return ret;
}
+void _expand_glob(SV *self, char *name)
+{
+ SV *namesv;
+
+ namesv = newSVsv(_get_name(self));
+ sv_catpvs(namesv, "::");
+ sv_catpv(namesv, name);
+
+ /* 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(namesv, GV_ADD, SVt_NULL);
+ SvREFCNT_dec(namesv);
+}
+
SV *_get_symbol(SV *self, varspec_t *variable, int vivify)
{
HV *namespace;
@@ -297,18 +311,8 @@ SV *_get_symbol(SV *self, varspec_t *variable, int vivify)
return NULL;
glob = (GV*)(*entry);
- if (!isGV(glob)) {
- SV *namesv;
-
- namesv = newSVsv(_get_name(self));
- sv_catpvs(namesv, "::");
- sv_catpv(namesv, variable->name);
-
- /* 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(namesv, GV_ADD, vartype_to_svtype(variable->type));
- SvREFCNT_dec(namesv);
- }
+ if (!isGV(glob))
+ _expand_glob(self, variable->name);
if (vivify) {
switch (variable->type) {