use the package::stash get_all_package_symbols implementation
Jesse Luehrs [Sun, 14 Nov 2010 20:04:16 +0000 (14:04 -0600)]
lib/Class/MOP/Package.pm
mop.c
xs/Package.xs

index 2d79261..827aa78 100644 (file)
@@ -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 (file)
--- 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)
 {
index ce8d390..6c47099 100644 (file)
@@ -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);