Include method name in immutable methods (fixes #49680)
[gitmo/Class-MOP.git] / xs / MOP.xs
index cf07b55..959df7a 100644 (file)
--- a/xs/MOP.xs
+++ b/xs/MOP.xs
@@ -16,7 +16,6 @@ find_method (const char *key, STRLEN keylen, SV *val, void *ud)
 }
 
 EXTERN_C XS(boot_Class__MOP__Package);
-EXTERN_C XS(boot_Class__MOP__Class);
 EXTERN_C XS(boot_Class__MOP__Attribute);
 EXTERN_C XS(boot_Class__MOP__Method);
 
@@ -32,7 +31,6 @@ BOOT:
     mop_associated_metaclass = newSVpvs("associated_metaclass");
 
     MOP_CALL_BOOT (boot_Class__MOP__Package);
-    MOP_CALL_BOOT (boot_Class__MOP__Class);
     MOP_CALL_BOOT (boot_Class__MOP__Attribute);
     MOP_CALL_BOOT (boot_Class__MOP__Method);
 
@@ -45,10 +43,11 @@ get_code_info(coderef)
         char *pkg  = NULL;
         char *name = NULL;
     PPCODE:
+        SvGETMAGIC(coderef);
         if (mop_get_code_info(coderef, &pkg, &name)) {
             EXTEND(SP, 2);
-            PUSHs(newSVpv(pkg, 0));
-            PUSHs(newSVpv(name, 0));
+            mPUSHs(newSVpv(pkg, 0));
+            mPUSHs(newSVpv(name, 0));
         }
 
 # This is some pretty grotty logic. It _should_ be parallel to the
@@ -61,7 +60,8 @@ is_class_loaded(klass=&PL_sv_undef)
         HV *stash;
         bool found_method = FALSE;
     PPCODE:
-        if (!SvPOK(klass) || !SvCUR(klass)) {
+        SvGETMAGIC(klass);
+        if (!(SvPOKp(klass) && SvCUR(klass))) { /* XXX: SvPOK does not work with magical scalars */
             XSRETURN_NO;
         }