We only need local $? if we inline calls to DEMOLISH
[gitmo/Moose.git] / xs / Method.xs
index 590cd06..5ffa467 100644 (file)
@@ -8,3 +8,16 @@ BOOT:
     INSTALL_SIMPLE_READER(Method, name);
     INSTALL_SIMPLE_READER(Method, package_name);
     INSTALL_SIMPLE_READER(Method, body);
+
+bool
+is_stub(self)
+    SV *self
+
+    PREINIT:
+        CV *const body = (CV *)SvRV( HeVAL( hv_fetch_ent((HV *)SvRV(self), KEY_FOR(body), 0, HASH_FOR(body)) ) );
+
+    CODE:
+        RETVAL = !( CvISXSUB(body) || CvROOT(body) );
+
+    OUTPUT:
+        RETVAL