sub initialize {
my $class = shift;
my $pkg = shift;
- return Class::MOP::get_metaclass_by_name($pkg)
+ 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 _immutable_options {
sub create {
my ($self, $package_name, %options) = @_;
-
+
(ref $options{roles} eq 'ARRAY')
|| $self->throw_error("You must pass an ARRAY ref of roles", data => $options{roles})
if exists $options{roles};
if ($roles) {
Moose::Util::apply_all_roles( $class, @$roles );
}
-
+
return $class;
}
my ($self, %options) = @_;
my $cache_ok = delete $options{cache};
-
+
# something like Super::Class|Super::Class::2=Role|Role::1
my $cache_key = join '=' => (
join('|', @{$options{superclasses} || []}),
join('|', sort @{$options{roles} || []}),
);
-
+
if ($cache_ok && defined $ANON_CLASSES{$cache_key}) {
return $ANON_CLASSES{$cache_key};
}
-
+
my $new_class = $self->SUPER::create_anon_class(%options);
$ANON_CLASSES{$cache_key} = $new_class
my $self = shift;
$self->SUPER::add_attribute(
(blessed $_[0] && $_[0]->isa('Class::MOP::Attribute')
- ? $_[0]
- : $self->_process_attribute(@_))
+ ? $_[0]
+ : $self->_process_attribute(@_))
);
}