From: Scott McWhirter Date: Wed, 28 May 2008 04:52:42 +0000 (+0000) Subject: Very small namespace() related refactor. X-Git-Tag: 0_64~43 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a38e4d1a6e824bb09d9f5d045b67b3ee67062b11;p=gitmo%2FClass-MOP.git Very small namespace() related refactor. --- diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index 3059d56..dbac031 100644 --- a/lib/Class/MOP/Package.pm +++ b/lib/Class/MOP/Package.pm @@ -202,11 +202,13 @@ sub remove_package_symbol { sub list_all_package_symbols { my ($self, $type_filter) = @_; - return keys %{$self->namespace} unless defined $type_filter; + + my $namespace = $self->namespace; + return keys %{$namespace} unless defined $type_filter; + # NOTE: # or we can filter based on # type (SCALAR|ARRAY|HASH|CODE) - my $namespace = $self->namespace; return grep { (ref($namespace->{$_}) ? (ref($namespace->{$_}) eq 'SCALAR' && $type_filter eq 'CODE') @@ -217,11 +219,12 @@ sub list_all_package_symbols { sub get_all_package_symbols { my ($self, $type_filter) = @_; - return %{$self->namespace} unless defined $type_filter; + my $namespace = $self->namespace; + return %{$namespace} unless defined $type_filter; + # NOTE: # or we can filter based on # type (SCALAR|ARRAY|HASH|CODE) - my $namespace = $self->namespace; no strict 'refs'; return map { $_ => (ref($namespace->{$_}) eq 'SCALAR'