Rename XS funcs which generate XSUBs
[gitmo/Mouse.git] / lib / Mouse / Meta / Class.pm
index e8593f6..0cc4b71 100644 (file)
@@ -54,9 +54,16 @@ sub superclasses {
         foreach my $super(@_){
             Mouse::Util::load_class($super);
             my $meta = Mouse::Util::get_metaclass_by_name($super);
+
+            next if not defined $meta;
+
             if(Mouse::Util::is_a_metarole($meta)){
                 $self->throw_error("You cannot inherit from a Mouse Role ($super)");
             }
+
+            next if $self->isa(ref $meta); # _superclass_meta_is_compatible
+
+            $self->_reconcile_with_superclass_meta($meta);
         }
         @{ $self->{superclasses} } = @_;
     }
@@ -64,6 +71,32 @@ sub superclasses {
     return @{ $self->{superclasses} };
 }
 
+my @MetaClassTypes = qw(
+    attribute_metaclass
+    method_metaclass
+    constructor_class
+    destructor_class
+);
+
+sub _reconcile_with_superclass_meta {
+    my($self, $super_meta) = @_;
+
+    my @incompatibles;
+
+    foreach my $metaclass_type(@MetaClassTypes){
+        my $super_c = $super_meta->$metaclass_type();
+        my $self_c  = $self->$metaclass_type();
+
+        if(!$super_c->isa($self_c)){
+            push @incompatibles, ($metaclass_type => $super_c);
+        }
+    }
+
+    $super_meta->reinitialize($self, @incompatibles);
+    return;
+}
+
+
 sub find_method_by_name{
     my($self, $method_name) = @_;
     defined($method_name)
@@ -485,8 +518,56 @@ metaclass.
 
 Throws an error with the given message.
 
+=head3 OTHER PUBLIC METHODS
+
+=head3 add_after_method_modifier
+
+=head3 add_around_method_modifier
+
+=head3 add_augment_method_modifier
+
+=head3 add_before_method_modifier
+
+=head3 add_override_method_modifier
+
+=head3 attribute_metaclass
+
+=head3 calculate_all_roles
+
+=head3 compute_all_applicable_attributes
+
+=head3 constructor_class
+
+=head3 create_anon_class
+
+=head3 destructor_class
+
+=head3 does_role
+
+=head3 find_attribute_by_name
+
+=head3 find_method_by_name
+
+=head3 get_all_method_names
+
+=head3 is_anon_class
+
+=head3 is_immutable
+
+=head3 is_mutable
+
+=head3 make_immutable
+
+=head3 make_mutable
+
+=head3 method_metaclass
+
+=head3 roles
+
 =head1 SEE ALSO
 
+L<Mouse::Meta::Module>
+
 L<Moose::Meta::Class>
 
 L<Class::MOP::Class>