Fix for "[ID 20000329.080] quad printing does not work as documented",
[p5sagit/p5-mst-13.2.git] / universal.c
index f6b25a4..fc0ec41 100644 (file)
@@ -139,7 +139,10 @@ XS(XS_UNIVERSAL_isa)
 
     sv = ST(0);
 
-    if (!SvOK(sv) || !(SvROK(sv) || SvCUR(sv)))
+    if (SvGMAGICAL(sv))
+       mg_get(sv);
+
+    if (!SvOK(sv) || !(SvROK(sv) || (SvPOK(sv) && SvCUR(sv))))
        XSRETURN_UNDEF;
 
     name = (char *)SvPV(ST(1),n_a);
@@ -162,7 +165,10 @@ XS(XS_UNIVERSAL_can)
 
     sv = ST(0);
 
-    if (!SvOK(sv) || !(SvROK(sv) || SvCUR(sv)))
+    if (SvGMAGICAL(sv))
+       mg_get(sv);
+
+    if (!SvOK(sv) || !(SvROK(sv) || (SvPOK(sv) && SvCUR(sv))))
        XSRETURN_UNDEF;
 
     name = (char *)SvPV(ST(1),n_a);
@@ -240,8 +246,8 @@ XS(XS_UNIVERSAL_VERSION)
                    /* they said C<use Foo v1.2.3> and $Foo::VERSION
                     * doesn't look like a float: do string compare */
                    if (sv_cmp(req,sv) == 1) {
-                       Perl_croak(aTHX_ "%s version v%vd required--"
-                                  "this is only version v%vd",
+                       Perl_croak(aTHX_ "%s v%vd required--"
+                                  "this is only v%vd",
                                   HvNAME(pkg), req, sv);
                    }
                    goto finish;