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 return 1 if is_class_loaded($class);
88 (my $file = "$class.pm") =~ s{::}{/}g;
90 eval { CORE::require($file) };
91 confess "Could not load class ($class) because : $@" if $@;
100 return 1 if defined ${"${class}::VERSION"} || defined @{"${class}::ISA"};
101 foreach my $symbol (keys %{"${class}::"}) {
102 next if substr($symbol, -2, 2) eq '::';
103 return 1 if defined &{"${class}::${symbol}"};
114 Mouse - Moose minus antlers
118 Version 0.01 released ???
123 use Mouse; # automatically turns on strict and warnings
125 has 'x' => (is => 'rw', isa => 'Int');
126 has 'y' => (is => 'rw', isa => 'Int');
139 has 'z' => (is => 'rw', isa => 'Int');
141 #after 'clear' => sub {
152 =head2 meta -> Mouse::Class
154 Returns this class' metaclass instance.
156 =head2 extends superclasses
158 Sets this class' superclasses.
160 =head2 has (name|names) => parameters
162 Adds an attribute (or if passed an arrayref of names, multiple attributes) to
165 =head2 confess error -> BOOM
167 L<Carp/confess> for your convenience.
169 =head2 blessed value -> ClassName | undef
171 L<Scalar::Util/blessed> for your convenience.
177 Importing Mouse will default your class' superclass list to L<Mouse::Object>.
178 You may use L</extends> to replace the superclass list.
182 Please unimport Mouse so that if someone calls one of the keywords (such as
183 L</extends>) it will break loudly instead breaking subtly.
187 =head2 load_class Class::Name
189 This will load a given C<Class::Name> (or die if it's not loadable).
190 This function can be used in place of tricks like
191 C<eval "use $module"> or using C<require>.
195 Shawn M Moore, C<< <sartak at gmail.com> >>
201 Please report any bugs through RT: email
202 C<bug-mouse at rt.cpan.org>, or browse
203 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mouse>.
205 =head1 COPYRIGHT AND LICENSE
207 Copyright 2008 Shawn M Moore.
209 This program is free software; you can redistribute it and/or modify it
210 under the same terms as Perl itself.