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