10 use Scalar::Util 'blessed';
15 use Mouse::TypeRegistry;
22 my $meta = Mouse::Class->initialize($CALLER);
29 $caller->meta->superclasses(@_);
37 $names = [$names] if !ref($names);
39 for my $name (@$names) {
40 Mouse::Attribute->create($package, $name, @_);
54 my $exporter = Sub::Exporter::build_exporter({
56 groups => { default => [':all'] },
65 my $meta = Mouse::Class->initialize($CALLER);
66 $meta->superclasses('Mouse::Object')
67 unless $meta->superclasses;
76 for my $keyword (keys %exports) {
77 next if $keyword eq 'meta'; # we don't delete this one
78 delete ${ $caller . '::' }{$keyword};
86 (my $file = "$class.pm") =~ s{::}{/}g;
88 eval { CORE::require($file) };
89 confess "Could not load class ($class) because : $@"
91 && $@ !~ /^Can't locate .*? at /;
102 Mouse - miniature Moose near the speed of light
106 Version 0.01 released ???
120 predicate => 'has_y',
121 clearer => 'clear_y',
130 =head2 meta -> Mouse::Class
132 Returns this class' metaclass instance.
134 =head2 extends superclasses
136 Sets this class' superclasses.
138 =head2 has (name|names) => parameters
140 Adds an attribute (or if passed an arrayref of names, multiple attributes) to
143 =head2 confess error -> BOOM
145 L<Carp/confess> for your convenience.
147 =head2 blessed value -> ClassName | undef
149 L<Scalar::Util/blessed> for your convenience.
155 Importing Mouse will set your class' superclass list to L<Mouse::Object>.
156 You may use L</extends> to replace the superclass list.
160 Please unimport Mouse so that if someone calls one of the keywords (such as
161 L</extends>) it will break loudly instead breaking subtly.
165 =head2 load_class Class::Name
167 This will load a given Class::Name> (or die if it's not loadable).
168 This function can be used in place of tricks like
169 C<eval "use $module"> or using C<require>.
173 Shawn M Moore, C<< <sartak at gmail.com> >>
179 Please report any bugs through RT: email
180 C<bug-mouse at rt.cpan.org>, or browse
181 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mouse>.
183 =head1 COPYRIGHT AND LICENSE
185 Copyright 2008 Shawn M Moore.
187 This program is free software; you can redistribute it and/or modify it
188 under the same terms as Perl itself.