Updates to perlfunc.pod
[p5sagit/p5-mst-13.2.git] / gv.c
diff --git a/gv.c b/gv.c
index 3b09463..62afd91 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -341,7 +341,7 @@ I32 create;
 #ifdef VMS
        warn("Weird package name \"%s\" truncated", name);
 #else
-       warn("Weird package name \"%.*s...\" truncated", namelen, name);
+       warn("Weird package name \"%.*s...\" truncated", (int)namelen, name);
 #endif
     }
     Copy(name,tmpbuf,namelen,char);
@@ -636,6 +636,14 @@ I32 sv_type;
        sv_setpv(GvSV(gv),chopset);
        goto magicalize;
 
+    case '?':
+       if (len > 1)
+           break;
+#ifdef COMPLEX_STATUS
+       sv_upgrade(GvSV(gv), SVt_PVLV);
+#endif
+       goto magicalize;
+
     case '#':
     case '*':
        if (dowarn && len == 1 && sv_type == SVt_PV)
@@ -643,7 +651,6 @@ I32 sv_type;
        /* FALL THROUGH */
     case '[':
     case '!':
-    case '?':
     case '^':
     case '~':
     case '=':
@@ -701,10 +708,11 @@ I32 sv_type;
        break;
     case ']':
        if (len == 1) {
-           SV *sv;
-           sv = GvSV(gv);
+           SV *sv = GvSV(gv);
            sv_upgrade(sv, SVt_PVNV);
            sv_setpv(sv, patchlevel);
+           (void)sv_2nv(sv);
+           SvREADONLY_on(sv);
        }
        break;
     }
@@ -997,10 +1005,10 @@ HV* stash;
 
     if ( cp = (char *)AMG_names[0] ) {
        /* Try to find via inheritance. */
-       gv = gv_fetchmeth(stash, "()", 2, -1); /* A cooky: "()". */
+       gv = gv_fetchmeth(stash, "()", 2, -1); /* A cookie: "()". */
        if (gv) sv = GvSV(gv);
 
-       if (!gv) goto notable;
+       if (!gv) goto no_table;
        else if (SvTRUE(sv)) amt.fallback=AMGfallYES;
        else if (SvOK(sv)) amt.fallback=AMGfallNEVER;
     }
@@ -1009,7 +1017,7 @@ HV* stash;
         cv = 0;
         cp = (char *)AMG_names[i];
       
-       *buf = '(';                     /* A cooky: "(". */
+       *buf = '(';                     /* A cookie: "(". */
        strcpy(buf + 1, cp);
        DEBUG_o( deb("Checking overloading of `%s' in package `%.256s'\n",
                     cp, HvNAME(stash)) );
@@ -1057,7 +1065,7 @@ HV* stash;
     }
   }
   /* Here we have no table: */
- notable:
+ no_table:
   AMT_AMAGIC_off(&amt);
   sv_magic((SV*)stash, 0, 'c', (char*)&amt, sizeof(AMTS));
   return FALSE;
@@ -1222,8 +1230,9 @@ int flags;
       } else if (cvp && (cv=cvp[nomethod_amg])) {
        notfound = 1; lr = 1;
       } else {
-        if (off==-1) off=method;
-       sprintf(buf, "Operation `%s': no method found,%sargument %s%.256s%s%.256s",
+       if (off==-1) off=method;
+       sprintf(buf,
+               "Operation `%s': no method found,%sargument %s%.256s%s%.256s",
                      AMG_names[method + assignshift],
                      (flags & AMGf_unary ? " " : "\n\tleft "),
                      SvAMAGIC(left)? 
@@ -1250,7 +1259,8 @@ int flags;
     }
   }
   if (!notfound) {
-    DEBUG_o( deb("Overloaded operator `%s'%s%s%s:\n\tmethod%s found%s in package %.256s%s\n",
+    DEBUG_o( deb(
+  "Overloaded operator `%s'%s%s%s:\n\tmethod%s found%s in package %.256s%s\n",
                 AMG_names[off],
                 method+assignshift==off? "" :
                             " (initially `",
@@ -1306,11 +1316,6 @@ int flags;
     res=POPs;
     PUTBACK;
 
-    if (notfound) {
-      /* sv_2mortal(res); */
-      return NULL;
-    }
-
     if (postpr) {
       int ans;
       switch (method) {