use Scalar::Util 'blessed';
use Carp 'confess';
-our $VERSION = '0.64_01';
+our $VERSION = '0.68';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
# we hand-construct the class
# until we can bootstrap it
if ( my $meta = Class::MOP::get_metaclass_by_name($package_name) ) {
- return $meta;
+ return $meta;
} else {
- my $meta = ( ref $class || $class )->_new({
- 'package' => $package_name,
- });
+ my $meta = ( ref $class || $class )->_new({
+ 'package' => $package_name,
+ });
- Class::MOP::store_metaclass_by_name($package_name, $meta);
+ Class::MOP::store_metaclass_by_name($package_name, $meta);
- return $meta;
+ return $meta;
}
}
sub get_all_package_symbols {
my ($self, $type_filter) = @_;
+
+ die "Cannot call get_all_package_symbols as a class method"
+ unless ref $self;
+
my $namespace = $self->namespace;
return %$namespace unless defined $type_filter;
- # for some reason this nasty impl is orders of magnitude aster than a clean version
+ # for some reason this nasty impl is orders of magnitude faster than a clean version
if ( $type_filter eq 'CODE' ) {
my $pkg;
no strict 'refs';
return map {
(ref($namespace->{$_})
? ( $_ => \&{$pkg ||= $self->name . "::$_"} )
- : ( *{$namespace->{$_}}{CODE}
- ? ( $_ => *{$namespace->{$_}}{$type_filter} )
- : ()))
+ : ( (*{$namespace->{$_}}{CODE}) # the extra parents prevent breakage on 5.8.2
+ ? ( $_ => *{$namespace->{$_}}{CODE} )
+ : () ) )
} keys %$namespace;
} else {
return map {