summaryrefslogtreecommitdiff
path: root/xs/MOP.xs
diff options
context:
space:
mode:
Diffstat (limited to 'xs/MOP.xs')
-rw-r--r--xs/MOP.xs21
1 files changed, 21 insertions, 0 deletions
diff --git a/xs/MOP.xs b/xs/MOP.xs
new file mode 100644
index 0000000..0bf05dc
--- /dev/null
+++ b/xs/MOP.xs
@@ -0,0 +1,21 @@
+#include "mop.h"
+
+MODULE = Class::MOP PACKAGE = Class::MOP
+
+PROTOTYPES: DISABLE
+
+# use prototype here to be compatible with get_code_info from Sub::Identify
+void
+get_code_info(coderef)
+ SV *coderef
+ PROTOTYPE: $
+ PREINIT:
+ char *pkg = NULL;
+ char *name = NULL;
+ PPCODE:
+ SvGETMAGIC(coderef);
+ if (mop_get_code_info(coderef, &pkg, &name)) {
+ EXTEND(SP, 2);
+ mPUSHs(newSVpv(pkg, 0));
+ mPUSHs(newSVpv(name, 0));
+ }