This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Change name of OP_SPECIFIC to OP_THREADSV. Fixed perl_get_sv when
[perl5.git] / universal.c
index 03b907d..d6689f8 100644 (file)
@@ -71,7 +71,7 @@ int level;
        }
     }
 
-    return &sv_no;
+    return boolSV(strEQ(name, "UNIVERSAL"));
 }
 
 bool
@@ -120,8 +120,7 @@ XS(XS_UNIVERSAL_isa)
     sv = ST(0);
     name = (char *)SvPV(ST(1),na);
 
-    ST(0) = (sv_derived_from(sv, name) ? &sv_yes : &sv_no) ;
-
+    ST(0) = boolSV(sv_derived_from(sv, name));
     XSRETURN(1);
 }
 
@@ -132,8 +131,6 @@ XS(XS_UNIVERSAL_can)
     SV   *sv;
     char *name;
     SV   *rv;
-    GV   *gv;
-    CV   *cvp;
     HV   *pkg = NULL;
 
     if (items != 2)
@@ -153,16 +150,9 @@ XS(XS_UNIVERSAL_can)
     }
 
     if (pkg) {
-        gv = gv_fetchmethod(pkg, name);
-
-        if(gv && GvCV(gv)) {
-            /* If the sub is only a stub then we may have a gv to AUTOLOAD */
-            GV **gvp = (GV**)hv_fetch(GvSTASH(gv), name, strlen(name), TRUE);
-            if(gvp && (cvp = GvCV(*gvp))) {
-                rv = sv_newmortal();
-                sv_setsv(rv, newRV((SV*)cvp));
-            }
-        }
+        GV *gv = gv_fetchmethod_autoload(pkg, name, FALSE);
+        if (gv && isGV(gv))
+           rv = sv_2mortal(newRV((SV*)GvCV(gv)));
     }
 
     ST(0) = rv;