10 use Scalar::Util 'blessed';
21 my $meta = Mouse::Class->initialize($CALLER);
28 $caller->meta->superclasses(@_);
36 $names = [$names] if !ref($names);
38 for my $name (@$names) {
39 Mouse::Attribute->create($package, $name, @_);
45 return \&Carp::confess;
49 return \&Scalar::Util::blessed;
53 my $exporter = Sub::Exporter::build_exporter({
55 groups => { default => [':all'] },
65 @{ $CALLER . '::ISA' } = 'Mouse::Object';
74 for my $keyword (keys %exports) {
75 next if $keyword eq 'meta'; # we don't delete this one
76 delete ${ $caller . '::' }{$keyword};
84 (my $file = "$class.pm") =~ s{::}{/}g;
86 eval { CORE::require($file) };
87 confess "Could not load class ($class) because : $@"
89 && $@ !~ /^Can't locate .*? at /;
100 Mouse - miniature Moose near the speed of light
104 Version 0.01 released ???
118 predicate => 'has_y',
119 clearer => 'clear_y',
128 =head2 meta -> Mouse::Class
130 Returns this class' metaclass instance.
132 =head2 extends superclasses
134 Sets this class' superclasses.
136 =head2 has (name|names) => parameters
138 Adds an attribute (or if passed an arrayref of names, multiple attributes) to
141 =head2 confess error -> BOOM
143 L<Carp/confess> for your convenience.
145 =head2 blessed value -> ClassName | undef
147 L<Scalar::Util/blessed> for your convenience.
153 Importing Mouse will set your class' superclass list to L<Mouse::Object>.
154 You may use L</extends> to replace the superclass list.
158 Please unimport Mouse so that if someone calls one of the keywords (such as
159 L</extends>) it will break loudly instead breaking subtly.
163 =head2 load_class Class::Name
165 This will load a given Class::Name> (or die if it's not loadable).
166 This function can be used in place of tricks like
167 C<eval "use $module"> or using C<require>.
171 Shawn M Moore, C<< <sartak at gmail.com> >>
177 Please report any bugs through RT: email
178 C<bug-mouse at rt.cpan.org>, or browse
179 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mouse>.
181 =head1 COPYRIGHT AND LICENSE
183 Copyright 2008 Shawn M Moore.
185 This program is free software; you can redistribute it and/or modify it
186 under the same terms as Perl itself.