summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorChip Salzenberg <chip@perl.com>1997-04-03 10:03:18 +1200
committerChip Salzenberg <chip@atlantic.net>1997-04-03 10:03:25 +1200
commit09280a334577a8254c4115b822e1f8cc667611a1 (patch)
tree5248ec052bcee25ef7a4efc61f20a99d7e7a04e8 /gv.c
parent8523fd8370f87f8e7cc44b73b86edff69f32270d (diff)
downloadperl-09280a334577a8254c4115b822e1f8cc667611a1.tar.gz
Fix AUTOLOAD, or kill me
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gv.c b/gv.c
index 98526ca91e..9aa4c54d52 100644
--- a/gv.c
+++ b/gv.c
@@ -285,8 +285,19 @@ I32 autoload;
}
else if (autoload) {
CV* cv = GvCV(gv);
- if (!cv || (!CvROOT(cv) && !CvXSUB(cv))) {
- GV* autogv = gv_autoload4(GvSTASH(gv), name, nend - name, TRUE);
+ if (!CvROOT(cv) && !CvXSUB(cv)) {
+ GV* stubgv;
+ GV* autogv;
+
+ if (CvANON(cv))
+ stubgv = gv;
+ else {
+ stubgv = CvGV(cv);
+ if (GvCV(stubgv) != cv) /* orphaned import */
+ stubgv = gv;
+ }
+ autogv = gv_autoload4(GvSTASH(stubgv),
+ GvNAME(stubgv), GvNAMELEN(stubgv), TRUE);
if (autogv)
gv = autogv;
}