}
static bool
+find_method (const char *key, STRLEN keylen, SV *val, void *ud)
+{
+ bool *found_method = (bool *)ud;
+ *found_method = TRUE;
+ return FALSE;
+}
+
+static bool
collect_all_symbols (const char *key, STRLEN keylen, SV *val, void *ud)
{
HV *hash = (HV *)ud;
SV *klass
PREINIT:
HV *stash;
- HV *symbols;
+ bool found_method = FALSE;
PPCODE:
if (!SvPOK(klass) || !SvCUR(klass)) {
XSRETURN_NO;
}
}
- symbols = get_all_package_symbols(stash, TYPE_FILTER_CODE);
- if (HvKEYS(symbols) > 0) {
- SvREFCNT_dec((SV *)symbols);
+ get_package_symbols(stash, TYPE_FILTER_CODE, find_method, &found_method);
+ if (found_method) {
XSRETURN_YES;
}
- SvREFCNT_dec((SV *)symbols);
XSRETURN_NO;
MODULE = Class::MOP PACKAGE = Class::MOP::Package