#include "mouse.h" MODULE = Mouse PACKAGE = Mouse::Util PROTOTYPES: DISABLE bool is_class_loaded(SV* sv = &PL_sv_undef) void get_code_info(CV* code) PREINIT: GV* gv; HV* stash; PPCODE: if((gv = CvGV(code)) && isGV(gv) && (stash = GvSTASH(gv))){ EXTEND(SP, 2); mPUSHs(newSVpvn_share(HvNAME_get(stash), HvNAMELEN_get(stash), 0U)); mPUSHs(newSVpvn_share(GvNAME_get(gv), GvNAMELEN_get(gv), 0U)); } SV* get_code_package(CV* code) PREINIT: HV* stash; CODE: if(CvGV(code) && isGV(CvGV(code)) && (stash = GvSTASH(CvGV(code)))){ RETVAL = newSVpvn_share(HvNAME_get(stash), HvNAMELEN_get(stash), 0U); } else{ RETVAL = &PL_sv_no; } OUTPUT: RETVAL MODULE = Mouse PACKAGE = Mouse::Meta::Module BOOT: INSTALL_SIMPLE_READER_WITH_KEY(Module, name, package); INSTALL_SIMPLE_READER_WITH_KEY(Module, _method_map, methods); INSTALL_SIMPLE_READER_WITH_KEY(Module, _attribute_map, attributes); HV* namespace(HV* self) CODE: { SV** svp = hv_fetchs(self, "package", FALSE); if(!(svp && SvOK(*svp))){ croak("No package name"); } RETVAL = gv_stashsv(*svp, GV_ADDMULTI); } OUTPUT: RETVAL MODULE = Mouse PACKAGE = Mouse::Meta::Class BOOT: INSTALL_SIMPLE_READER(Class, roles); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Class, is_anon_class, anon_serial_id); MODULE = Mouse PACKAGE = Mouse::Meta::Role BOOT: INSTALL_SIMPLE_READER_WITH_KEY(Role, get_roles, roles); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Role, is_anon_role, anon_serial_id); MODULE = Mouse PACKAGE = Mouse::Meta::Attribute BOOT: /* readers */ INSTALL_SIMPLE_READER(Attribute, name); INSTALL_SIMPLE_READER(Attribute, associated_class); INSTALL_SIMPLE_READER(Attribute, accessor); INSTALL_SIMPLE_READER(Attribute, reader); INSTALL_SIMPLE_READER(Attribute, writer); INSTALL_SIMPLE_READER(Attribute, predicate); INSTALL_SIMPLE_READER(Attribute, clearer); INSTALL_SIMPLE_READER(Attribute, handles); INSTALL_SIMPLE_READER_WITH_KEY(Attribute, _is_metadata, is); INSTALL_SIMPLE_READER_WITH_KEY(Attribute, is_required, required); INSTALL_SIMPLE_READER(Attribute, default); INSTALL_SIMPLE_READER_WITH_KEY(Attribute, is_lazy, lazy); INSTALL_SIMPLE_READER_WITH_KEY(Attribute, is_lazy_build, lazy_build); INSTALL_SIMPLE_READER_WITH_KEY(Attribute, is_weak_ref, weak_ref); INSTALL_SIMPLE_READER(Attribute, init_arg); INSTALL_SIMPLE_READER(Attribute, type_constraint); INSTALL_SIMPLE_READER(Attribute, trigger); INSTALL_SIMPLE_READER(Attribute, builder); INSTALL_SIMPLE_READER_WITH_KEY(Attribute, should_auto_deref, auto_deref); INSTALL_SIMPLE_READER_WITH_KEY(Attribute, should_coerce, coerce); INSTALL_SIMPLE_READER(Attribute, documentation); /* predicates */ INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_accessor, accessor); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_reader, reader); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_writer, writer); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_predicate, predicate); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_clearer, clearer); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_handles, handles); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_default, default); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_type_constraint, type_constraint); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_trigger, trigger); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_builder, builder); INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_documentation, documentation); MODULE = Mouse PACKAGE = Mouse::Meta::TypeConstraint BOOT: INSTALL_SIMPLE_READER(TypeConstraint, name); INSTALL_SIMPLE_READER(TypeConstraint, parent); INSTALL_SIMPLE_READER(TypeConstraint, message); INSTALL_SIMPLE_READER_WITH_KEY(TypeConstraint, _compiled_type_constraint, compiled_type_constraint); INSTALL_SIMPLE_READER(TypeConstraint, _compiled_type_coercion); /* Mouse specific */ INSTALL_SIMPLE_PREDICATE_WITH_KEY(TypeConstraint, has_coercion, _compiled_type_coercion);