2 use Mouse::Util qw(does dump meta); # enables strict and warnings
10 return unless $self->can('BUILD');
12 for my $class (reverse $self->meta->linearized_isa) {
13 my $build = Mouse::Util::get_code_ref($class, 'BUILD')
25 return unless $self->can('DEMOLISH');
27 # We cannot count on being able to retrieve a previously made
28 # metaclass, _or_ being able to make a new one during global
29 # destruction. However, we should still be able to use mro at
30 # that time (at least tests suggest so ;)
32 foreach my $class (@{ Mouse::Util::get_linear_isa(ref $self) }) {
33 my $demolish = Mouse::Util::get_code_ref($class, 'DEMOLISH')
46 Mouse::Object - The base object for Mouse classes
50 This document describes Mouse version 0.42
54 =head2 C<< new (Arguments) -> Object >>
56 Instantiates a new C<Mouse::Object>. This is obviously intended for subclasses.
58 =head2 C<< BUILDARGS (Arguments) -> HashRef >>
60 Lets you override the arguments that C<new> takes. Return a hashref of
63 =head2 C<< BUILDALL (\%args) >>
65 Calls C<BUILD> on each class in the class hierarchy. This is called at the
68 =head2 C<< BUILD (\%args) >>
70 You may put any business logic initialization in BUILD methods. You don't
71 need to redispatch or return any specific value.
73 =head2 C<< DEMOLISHALL >>
75 Calls C<DEMOLISH> on each class in the class hierarchy. This is called at
78 =head2 C<< DEMOLISH >>
80 You may put any business logic deinitialization in DEMOLISH methods. You don't
81 need to redispatch or return any specific value.
84 =head2 C<< does ($role_name) -> Bool >>
86 This will check if the invocant's class B<does> a given C<$role_name>.
87 This is similar to "isa" for object, but it checks the roles instead.
89 =head2 C<<dump ($maxdepth) -> Str >>
93 C'mon, how many times have you written the following code while debugging:
98 It can get seriously annoying, so why not just use this.
100 The implementation was lifted directly from Moose::Object.