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