From: Jesse Luehrs Date: Sun, 14 Nov 2010 20:04:16 +0000 (-0600) Subject: use the package::stash get_all_package_symbols implementation X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6b20722d42108b3c94300147601041000c7d6bdf;p=gitmo%2FClass-MOP.git use the package::stash get_all_package_symbols implementation --- diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index 2d79261..827aa78 100644 --- a/lib/Class/MOP/Package.pm +++ b/lib/Class/MOP/Package.pm @@ -138,6 +138,11 @@ sub list_all_package_symbols { $self->_package_stash->list_all_symbols(@_); } +sub get_all_package_symbols { + my $self = shift; + $self->_package_stash->get_all_symbols(@_); +} + 1; __END__ diff --git a/mop.c b/mop.c index a5ded4f..d1b252b 100644 --- a/mop.c +++ b/mop.c @@ -106,6 +106,7 @@ mop_get_code_info (SV *coderef, char **pkg, char **name) return 1; } +/* XXX: eventually this should just use the implementation in Package::Stash */ void mop_get_package_symbols (HV *stash, type_filter_t filter, get_package_symbols_cb_t cb, void *ud) { diff --git a/xs/Package.xs b/xs/Package.xs index ce8d390..6c47099 100644 --- a/xs/Package.xs +++ b/xs/Package.xs @@ -4,36 +4,5 @@ MODULE = Class::MOP::Package PACKAGE = Class::MOP::Package PROTOTYPES: DISABLE -void -get_all_package_symbols(self, filter=TYPE_FILTER_NONE) - SV *self - type_filter_t filter - PREINIT: - HV *stash = NULL; - HV *symbols = NULL; - register HE *he; - PPCODE: - if ( ! SvROK(self) ) { - die("Cannot call get_all_package_symbols as a class method"); - } - - if (GIMME_V == G_VOID) { - XSRETURN_EMPTY; - } - - PUTBACK; - - if ( (he = hv_fetch_ent((HV *)SvRV(self), KEY_FOR(package), 0, HASH_FOR(package))) ) { - stash = gv_stashsv(HeVAL(he), 0); - } - - - if (!stash) { - XSRETURN_UNDEF; - } - - symbols = mop_get_all_package_symbols(stash, filter); - PUSHs(sv_2mortal(newRV_noinc((SV *)symbols))); - BOOT: INSTALL_SIMPLE_READER_WITH_KEY(Package, name, package);