2 package Mouse::Meta::Class;
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 get_attribute_map { $_[0]->{attributes} }
53 sub get_attribute { $_[0]->{attributes}->{$_[1]} }
55 sub linearized_isa { @{ mro::get_linear_isa($_[0]->name) } }
63 Mouse::Meta::Class - hook into the Mouse MOP
67 =head2 initialize ClassName -> Mouse::Meta::Class
69 Finds or creates a Mouse::Meta::Class instance for the given ClassName. Only
70 one instance should exist for a given class.
72 =head2 new %args -> Mouse::Meta::Class
74 Creates a new Mouse::Meta::Class. Don't call this directly.
76 =head2 name -> ClassName
78 Returns the name of the owner class.
80 =head2 superclasses -> [ClassName]
82 Gets (or sets) the list of superclasses of the owner class.
84 =head2 add_attribute Mouse::Meta::Attribute
86 Begins keeping track of the existing L<Mouse::Meta::Attribute> for the owner
89 =head2 get_attribute_map -> { name => Mouse::Meta::Attribute }
91 Returns a mapping of attribute names to their corresponding
92 L<Mouse::Meta::Attribute> objects.
94 =head2 get_attribute Name -> Mouse::Meta::Attribute | undef
96 Returns the L<Mouse::Meta::Attribute> with the given name.
98 =head2 linearized_isa -> [ClassNames]
100 Returns the list of classes in method dispatch order, with duplicates removed.