add in the cross version XS headers so we can build under 5.10
[gitmo/Class-MOP.git] / MOP.xs
CommitLineData
e0e4674a 1
2#include "EXTERN.h"
3#include "perl.h"
4#include "XSUB.h"
b0e94057 5#include "ppport.h"
e0e4674a 6
7/*
8check_method_cache_flag:
9 check the PL_sub_generation
10 ISA/method cache thing
11
12get_code_info:
13 Pass in a coderef, returns:
14 [ $pkg_name, $coderef_name ] ie:
15 [ 'Foo::Bar', 'new' ]
16*/
17
18MODULE = Class::MOP PACKAGE = Class::MOP
19
20SV*
21check_package_cache_flag()
22 CODE:
23 RETVAL = newSViv(PL_sub_generation);
24 OUTPUT:
25 RETVAL
26
27void
28get_code_info(coderef)
29 SV* coderef
30 PREINIT:
31 char* name;
32 char* pkg;
33 PPCODE:
34
35 if( SvOK(coderef) && SvROK(coderef) && SvTYPE(SvRV(coderef)) == SVt_PVCV){
36 coderef = SvRV(coderef);
37 name = GvNAME( CvGV(coderef) );
38 pkg = HvNAME( GvSTASH(CvGV(coderef)) );
39
40 EXTEND(SP, 2);
41 PUSHs(newSVpvn(pkg, strlen(pkg)));
42 PUSHs(newSVpvn(name, strlen(name)));
43 }
44