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, @_);
46 return \&Carp::confess;
50 return \&Scalar::Util::blessed;
54 my $exporter = Sub::Exporter::build_exporter({
56 groups => { default => [':all'] },
66 @{ $CALLER . '::ISA' } = 'Mouse::Object';
75 for my $keyword (keys %exports) {
76 next if $keyword eq 'meta'; # we don't delete this one
77 delete ${ $caller . '::' }{$keyword};
85 (my $file = "$class.pm") =~ s{::}{/}g;
87 eval { CORE::require($file) };
88 confess "Could not load class ($class) because : $@"
90 && $@ !~ /^Can't locate .*? at /;
101 Mouse - miniature Moose near the speed of light
105 Version 0.01 released ???
119 predicate => 'has_y',
120 clearer => 'clear_y',
129 =head2 meta -> Mouse::Class
131 Returns this class' metaclass instance.
133 =head2 extends superclasses
135 Sets this class' superclasses.
137 =head2 has (name|names) => parameters
139 Adds an attribute (or if passed an arrayref of names, multiple attributes) to
142 =head2 confess error -> BOOM
144 L<Carp/confess> for your convenience.
146 =head2 blessed value -> ClassName | undef
148 L<Scalar::Util/blessed> for your convenience.
154 Importing Mouse will set your class' superclass list to L<Mouse::Object>.
155 You may use L</extends> to replace the superclass list.
159 Please unimport Mouse so that if someone calls one of the keywords (such as
160 L</extends>) it will break loudly instead breaking subtly.
164 =head2 load_class Class::Name
166 This will load a given Class::Name> (or die if it's not loadable).
167 This function can be used in place of tricks like
168 C<eval "use $module"> or using C<require>.
172 Shawn M Moore, C<< <sartak at gmail.com> >>
178 Please report any bugs through RT: email
179 C<bug-mouse at rt.cpan.org>, or browse
180 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mouse>.
182 =head1 COPYRIGHT AND LICENSE
184 Copyright 2008 Shawn M Moore.
186 This program is free software; you can redistribute it and/or modify it
187 under the same terms as Perl itself.