use Class::MOP;
use Carp 'confess';
-use Scalar::Util 'weaken', 'blessed', 'reftype';
+use Scalar::Util 'weaken', 'blessed';
-our $VERSION = '0.23';
+our $VERSION = '0.56';
our $AUTHORITY = 'cpan:STEVAN';
use Moose::Meta::Method::Overriden;
sub initialize {
my $class = shift;
my $pkg = shift;
- $class->SUPER::initialize($pkg,
- 'attribute_metaclass' => 'Moose::Meta::Attribute',
- 'method_metaclass' => 'Moose::Meta::Method',
- 'instance_metaclass' => 'Moose::Meta::Instance',
- @_);
+ return Class::MOP::get_metaclass_by_name($pkg)
+ || $class->SUPER::initialize($pkg,
+ 'attribute_metaclass' => 'Moose::Meta::Attribute',
+ 'method_metaclass' => 'Moose::Meta::Method',
+ 'instance_metaclass' => 'Moose::Meta::Instance',
+ @_
+ );
}
sub create {
sub get_method_map {
my $self = shift;
- if (defined $self->{'$!_package_cache_flag'} &&
- $self->{'$!_package_cache_flag'} == Class::MOP::check_package_cache_flag($self->meta->name)) {
- return $self->{'%!methods'};
+ my $current = Class::MOP::check_package_cache_flag($self->name);
+
+ if (defined $self->{'_package_cache_flag'} && $self->{'_package_cache_flag'} == $current) {
+ return $self->{'methods'};
}
- my $map = $self->{'%!methods'};
+ $self->{_package_cache_flag} = $current;
+
+ my $map = $self->{'methods'};
my $class_name = $self->name;
my $method_metaclass = $self->method_metaclass;
foreach my $super (@superclasses) {
# don't bother if it does not have a meta.
next unless $super->can('meta');
+ next unless $super->meta->isa("Class::MOP::Class");
# get the name, make sure we take
# immutable classes into account
my $super_meta_name = ($super->meta->is_immutable