]> git.vpit.fr Git - perl/modules/subs-auto.git/blobdiff - auto.xs
Get rid of Symbol and delete the code slot in XS
[perl/modules/subs-auto.git] / auto.xs
diff --git a/auto.xs b/auto.xs
new file mode 100644 (file)
index 0000000..35439a0
--- /dev/null
+++ b/auto.xs
@@ -0,0 +1,24 @@
+/* This file is part of the subs::auto Perl module.
+ * See http://search.cpan.org/dist/subs-auto/ */
+
+#define PERL_NO_GET_CONTEXT
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+MODULE = subs::auto      PACKAGE = subs::auto
+
+PROTOTYPES: ENABLE
+
+void
+_delete_sub(SV *fqn)
+PREINIT:
+ GV *gv;
+PPCODE:
+ gv = gv_fetchsv(fqn, 0, 0);
+ if (gv) {
+  CV *cv = GvCV(gv);
+  GvCV(gv) = NULL;
+  SvREFCNT_dec(cv);
+ }
+ XSRETURN(0);