This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Be a bit more specific in what our second typeglob isn't. It is actually
[perl5.git] / universal.c
index e1ceea1..182b5c9 100644 (file)
@@ -185,6 +185,7 @@ Perl_sv_does(pTHX_ SV *sv, const char *name)
 {
     const char *classname;
     bool does_it;
+    SV *methodname;
 
     dSP;
     ENTER;
@@ -199,7 +200,7 @@ Perl_sv_does(pTHX_ SV *sv, const char *name)
     if (sv_isobject(sv)) {
        classname = sv_reftype(SvRV(sv),TRUE);
     } else {
-       classname = SvPV(sv,PL_na);
+       classname = SvPV_nolen(sv);
     }
 
     if (strEQ(name,classname))
@@ -210,7 +211,12 @@ Perl_sv_does(pTHX_ SV *sv, const char *name)
     XPUSHs(sv_2mortal(newSVpv(name, 0)));
     PUTBACK;
 
-    call_method("isa", G_SCALAR);
+    methodname = sv_2mortal(newSVpv("isa", 0));
+    /* ugly hack: use the SvSCREAM flag so S_method_common
+     * can figure out we're calling DOES() and not isa(),
+     * and report eventual errors correctly. --rgs */
+    SvSCREAM_on(methodname);
+    call_sv(methodname, G_SCALAR | G_METHOD);
     SPAGAIN;
 
     does_it = SvTRUE( TOPs );
@@ -1209,8 +1215,8 @@ XS(XS_re_regnames)
                         I32 *nums = (I32*)SvPVX(sv_dat);
                         for ( i = 0; i < SvIVX(sv_dat); i++ ) {
                             if ((I32)(re->lastcloseparen) >= nums[i] &&
-                                re->startp[nums[i]] != -1 &&
-                                re->endp[nums[i]] != -1)
+                                re->offs[nums[i]].start != -1 &&
+                                re->offs[nums[i]].end != -1)
                             {
                                 parno = nums[i];
                                 break;
@@ -1291,8 +1297,8 @@ XS(XS_re_regnames_iternext)
                     I32 *nums = (I32*)SvPVX(sv_dat);
                     for ( i = 0; i < SvIVX(sv_dat); i++ ) {
                         if ((I32)(re->lastcloseparen) >= nums[i] &&
-                            re->startp[nums[i]] != -1 &&
-                            re->endp[nums[i]] != -1)
+                            re->offs[nums[i]].start != -1 &&
+                            re->offs[nums[i]].end != -1)
                         {
                             parno = nums[i];
                             break;