Skip processing a file if the file to be opened is '-'
[p5sagit/p5-mst-13.2.git] / gv.c
diff --git a/gv.c b/gv.c
index 50dc34d..f6c9744 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -59,6 +59,9 @@ Perl_gv_fetchfile(pTHX_ const char *name)
     STRLEN tmplen;
     GV *gv;
 
+    if (!PL_defstash)
+       return Nullgv;
+
     tmplen = strlen(name) + 2;
     if (tmplen < sizeof smallbuf)
        tmpbuf = smallbuf;
@@ -300,7 +303,7 @@ Perl_gv_fetchmethod_autoload(pTHX_ HV *stash, const char *name, I32 autoload)
        if ((nsplit - origname) == 5 && strnEQ(origname, "SUPER", 5)) {
            /* ->SUPER::method should really be looked up in original stash */
            SV *tmpstr = sv_2mortal(Perl_newSVpvf(aTHX_ "%s::SUPER",
-                                            HvNAME(PL_curcop->cop_stash)));
+                                                 CopSTASHPV(PL_curcop)));
            stash = gv_stashpvn(SvPVX(tmpstr), SvCUR(tmpstr), TRUE);
            DEBUG_o( Perl_deb(aTHX_ "Treating %s as %s::%s\n",
                         origname, HvNAME(stash), name) );
@@ -445,8 +448,8 @@ Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 add, I32 sv_type)
        name++;
 
     for (namend = name; *namend; namend++) {
-       if ((*namend == '\'' && namend[1]) ||
-           (*namend == ':' && namend[1] == ':'))
+       if ((*namend == ':' && namend[1] == ':')
+           || (*namend == '\'' && namend[1]))
        {
            if (!stash)
                stash = PL_defstash;
@@ -559,7 +562,7 @@ Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 add, I32 sv_type)
                }
            }
            else
-               stash = PL_curcop->cop_stash;
+               stash = CopSTASH(PL_curcop);
        }
        else
            stash = PL_defstash;
@@ -929,6 +932,8 @@ Perl_newGVgen(pTHX_ char *pack)
 GP*
 Perl_gp_ref(pTHX_ GP *gp)
 {
+    if (!gp)
+       return (GP*)NULL;
     gp->gp_refcnt++;
     if (gp->gp_cv) {
        if (gp->gp_cvgen) {