sub _check_metaclass_compatibility {
my $self = shift;
- if (my @superclasses = $self->superclasses) {
- $self->_fix_metaclass_incompatibility(@superclasses);
+ my @superclasses = $self->superclasses
+ or return;
+
+ $self->_fix_metaclass_incompatibility(@superclasses);
- my %base_metaclass = $self->_base_metaclasses;
+ my %base_metaclass = $self->_base_metaclasses;
- # this is always okay ...
- return if ref($self) eq 'Class::MOP::Class'
+ # this is always okay ...
+ return
+ if ref($self) eq 'Class::MOP::Class'
&& all {
my $meta = $self->$_;
- !defined($meta) || $meta eq $base_metaclass{$_}
- } keys %base_metaclass;
-
- for my $superclass (@superclasses) {
- $self->_check_class_metaclass_compatibility($superclass);
+ !defined($meta) || $meta eq $base_metaclass{$_};
}
+ keys %base_metaclass;
- for my $metaclass_type (keys %base_metaclass) {
- next unless defined $self->$metaclass_type;
- for my $superclass (@superclasses) {
- $self->_check_single_metaclass_compatibility(
- $metaclass_type, $superclass
- );
- }
+ for my $superclass (@superclasses) {
+ $self->_check_class_metaclass_compatibility($superclass);
+ }
+
+ for my $metaclass_type ( keys %base_metaclass ) {
+ next unless defined $self->$metaclass_type;
+ for my $superclass (@superclasses) {
+ $self->_check_single_metaclass_compatibility( $metaclass_type,
+ $superclass );
}
}
}