4 find_method (const char *key, STRLEN keylen, SV *val, void *ud)
6 bool *found_method = (bool *)ud;
8 PERL_UNUSED_ARG(keylen);
15 check_version (SV *klass, SV *required_version)
25 PUSHs(required_version);
28 call_method("VERSION", G_DISCARD|G_VOID|G_EVAL);
43 EXTERN_C XS(boot_Class__MOP__Mixin__HasMethods);
44 EXTERN_C XS(boot_Class__MOP__Package);
45 EXTERN_C XS(boot_Class__MOP__Mixin__AttributeCore);
46 EXTERN_C XS(boot_Class__MOP__Method);
48 MODULE = Class::MOP PACKAGE = Class::MOP
55 MOP_CALL_BOOT (boot_Class__MOP__Mixin__HasMethods);
56 MOP_CALL_BOOT (boot_Class__MOP__Package);
57 MOP_CALL_BOOT (boot_Class__MOP__Mixin__AttributeCore);
58 MOP_CALL_BOOT (boot_Class__MOP__Method);
60 # use prototype here to be compatible with get_code_info from Sub::Identify
62 get_code_info(coderef)
70 if (mop_get_code_info(coderef, &pkg, &name)) {
72 mPUSHs(newSVpv(pkg, 0));
73 mPUSHs(newSVpv(name, 0));
77 is_class_loaded(klass, options=NULL)
82 bool found_method = FALSE;
85 if (!(SvPOKp(klass) && SvCUR(klass))) { /* XXX: SvPOK does not work with magical scalars */
89 stash = gv_stashsv(klass, 0);
94 if (options && hv_exists_ent(options, KEY_FOR(_version), HASH_FOR(_version))) {
95 HE *required_version = hv_fetch_ent(options, KEY_FOR(_version), 0, HASH_FOR(_version));
96 if (check_version (klass, HeVAL(required_version))) {
103 if (hv_exists_ent (stash, KEY_FOR(VERSION), HASH_FOR(VERSION))) {
104 HE *version = hv_fetch_ent(stash, KEY_FOR(VERSION), 0, HASH_FOR(VERSION));
106 if (version && HeVAL(version) && (version_sv = GvSV(HeVAL(version)))) {
107 if (SvROK(version_sv)) {
108 SV *version_sv_ref = SvRV(version_sv);
110 if (SvOK(version_sv_ref)) {
114 else if (SvOK(version_sv)) {
120 if (hv_exists_ent (stash, KEY_FOR(ISA), HASH_FOR(ISA))) {
121 HE *isa = hv_fetch_ent(stash, KEY_FOR(ISA), 0, HASH_FOR(ISA));
122 if (isa && HeVAL(isa) && GvAV(HeVAL(isa)) && av_len(GvAV(HeVAL(isa))) != -1) {
127 mop_get_package_symbols(stash, TYPE_FILTER_CODE, find_method, &found_method);