13 $METACLASS_CACHE{$name} = $class->new(name => $name)
14 if !exists($METACLASS_CACHE{$name});
15 return $METACLASS_CACHE{$name};
23 $args{attributes} = {};
24 $args{superclasses} = do {
26 \@{ $args{name} . '::ISA' };
32 sub name { $_[0]->{name} }
38 Mouse::load_class($_) for @_;
39 @{ $self->{superclasses} } = @_;
42 @{ $self->{superclasses} };
49 $self->{'attributes'}{$attr->name} = $attr;
52 sub attributes { values %{ $_[0]->{'attributes'} } }
53 sub get_attribute_map { $_[0]->{attributes} }
54 sub get_attribute { $_[0]->{attributes}->{$_[1]} }
56 sub linearized_isa { @{ mro::get_linear_isa($_[0]->name) } }
64 Mouse::Class - hook into the Mouse MOP
68 =head2 initialize ClassName -> Mouse::Class
70 Finds or creates a Mouse::Class instance for the given ClassName. Only one
71 instance should exist for a given class.
73 =head2 new %args -> Mouse::Class
75 Creates a new Mouse::Class. Don't call this directly.
77 =head2 name -> ClassName
79 Returns the name of the owner class.
81 =head2 superclasses -> [ClassName]
83 Gets (or sets) the list of superclasses of the owner class.
85 =head2 add_attribute Mouse::Attribute
87 Begins keeping track of the existing L<Mouse::Attribute> for the owner class.
89 =head2 attributes -> [Mouse::Attribute]
91 Returns a list of L<Mouse::Attribute> objects.
93 =head2 get_attribute_map -> { name => Mouse::Attribute }
95 Returns a mapping of attribute names to their corresponding
96 L<Mouse::Attribute> objects.
98 =head2 get_attribute Name -> Mouse::Attribute | undef
100 Returns the L<Mouse::Attribute> with the given name.
102 =head2 linearized_isa -> [ClassNames]
104 Returns the list of classes in method dispatch order, with duplicates removed.