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 - Moose minus antlers
106 Version 0.01 released ???
111 use Mouse; # automatically turns on strict and warnings
113 has 'x' => (is => 'rw', isa => 'Int');
114 has 'y' => (is => 'rw', isa => 'Int');
127 has 'z' => (is => 'rw', isa => 'Int');
129 #after 'clear' => sub {
140 =head2 meta -> Mouse::Class
142 Returns this class' metaclass instance.
144 =head2 extends superclasses
146 Sets this class' superclasses.
148 =head2 has (name|names) => parameters
150 Adds an attribute (or if passed an arrayref of names, multiple attributes) to
153 =head2 confess error -> BOOM
155 L<Carp/confess> for your convenience.
157 =head2 blessed value -> ClassName | undef
159 L<Scalar::Util/blessed> for your convenience.
165 Importing Mouse will default your class' superclass list to L<Mouse::Object>.
166 You may use L</extends> to replace the superclass list.
170 Please unimport Mouse so that if someone calls one of the keywords (such as
171 L</extends>) it will break loudly instead breaking subtly.
175 =head2 load_class Class::Name
177 This will load a given C<Class::Name> (or die if it's not loadable).
178 This function can be used in place of tricks like
179 C<eval "use $module"> or using C<require>.
183 Shawn M Moore, C<< <sartak at gmail.com> >>
189 Please report any bugs through RT: email
190 C<bug-mouse at rt.cpan.org>, or browse
191 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mouse>.
193 =head1 COPYRIGHT AND LICENSE
195 Copyright 2008 Shawn M Moore.
197 This program is free software; you can redistribute it and/or modify it
198 under the same terms as Perl itself.