Merge branch 'master' of github.com:gfx/p5-Mouse-temporary
[gitmo/Mouse.git] / lib / Mouse / Object.pm
CommitLineData
c3398f5b 1package Mouse::Object;
007481ba 2use Mouse::Util qw(does dump meta); # enables strict and warnings
5ca73186 3# all the stuff are defined in XS or PP
d8ac424a 4
5sub DOES {
6 my($self, $class_or_role_name) = @_;
7 return $self->isa($class_or_role_name) || $self->does($class_or_role_name);
8}
9
c3398f5b 101;
c3398f5b 11__END__
12
13=head1 NAME
14
bedd575c 15Mouse::Object - The base object for Mouse classes
c3398f5b 16
a25ca8d6 17=head1 VERSION
18
14cf9b5a 19This document describes Mouse version 0.95
a25ca8d6 20
c3398f5b 21=head1 METHODS
22
5ca73186 23=head2 C<< $class->new(%args | \%args) -> Object >>
c3398f5b 24
1820fffe 25Instantiates a new C<Mouse::Object>. This is obviously intended for subclasses.
c3398f5b 26
5ca73186 27=head2 C<< $class->BUILDARGS(@args) -> HashRef >>
c3398f5b 28
5ca73186 29Lets you override the arguments that C<new> takes.
30It must return a HashRef of parameters.
c3398f5b 31
5ca73186 32=head2 C<< $object->BUILDALL(\%args) >>
c3398f5b 33
1820fffe 34Calls C<BUILD> on each class in the class hierarchy. This is called at the
35end of C<new>.
c3398f5b 36
5ca73186 37=head2 C<< $object->BUILD(\%args) >>
442125dc 38
1820fffe 39You may put any business logic initialization in BUILD methods. You don't
40need to redispatch or return any specific value.
442125dc 41
5ca73186 42=head2 C<< $object->DEMOLISHALL >>
c3398f5b 43
1820fffe 44Calls C<DEMOLISH> on each class in the class hierarchy. This is called at
45C<DESTROY> time.
c3398f5b 46
5ca73186 47=head2 C<< $object->DEMOLISH >>
c3398f5b 48
49You may put any business logic deinitialization in DEMOLISH methods. You don't
50need to redispatch or return any specific value.
51
5ca73186 52=head2 C<< $object->does($role_name) -> Bool >>
56a558f9 53
1820fffe 54This will check if the invocant's class B<does> a given C<$role_name>.
5ca73186 55This is similar to C<isa> for object, but it checks the roles instead.
df963a63 56
5ca73186 57=head2 C<< $object->dump($maxdepth) -> Str >>
df963a63 58
5ca73186 59This is a handy utility for dumping an object with Data::Dumper.
80a014b9 60By default, the maximum depth is 3, to avoid making a mess.
df963a63 61
80a014b9 62=head2 C<< $object->meta() -> MetaClass >>
df963a63 63
5ca73186 64This is a method which provides access to the object's metaclass.
df963a63 65
1820fffe 66=head1 SEE ALSO
67
68L<Moose::Object>
c3398f5b 69
1820fffe 70=cut
df963a63 71