Re: [ID 20020305.025] PACKAGE::SUPER doesn't work anymore
[p5sagit/p5-mst-13.2.git] / gv.c
diff --git a/gv.c b/gv.c
index 0921095..a89e900 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -422,9 +422,17 @@ Perl_gv_fetchmethod_autoload(pTHX_ HV *stash, const char *name, I32 autoload)
            DEBUG_o( Perl_deb(aTHX_ "Treating %s as %s::%s\n",
                         origname, HvNAME(stash), name) );
        }
-       else
+       else {
             /* don't autovifify if ->NoSuchStash::method */
             stash = gv_stashpvn(origname, nsplit - origname, FALSE);
+
+           /* however, explicit calls to Pkg::SUPER::method may
+              happen, and may require autovivification to work */
+           if (!stash && (nsplit - origname) >= 7 &&
+               strnEQ(nsplit - 7, "::SUPER", 7) &&
+               gv_stashpvn(origname, nsplit - origname - 7, FALSE))
+             stash = gv_stashpvn(origname, nsplit - origname, TRUE);
+       }
     }
 
     gv = gv_fetchmeth(stash, name, nend - name, 0);