2 use Mouse::Util qw(does dump); # enables strict and warnings
9 return unless $self->can('DEMOLISH'); # short circuit
19 # We cannot count on being able to retrieve a previously made
20 # metaclass, _or_ being able to make a new one during global
21 # destruction. However, we should still be able to use mro at
22 # that time (at least tests suggest so ;)
24 foreach my $class (@{ Mouse::Util::get_linear_isa(ref $self) }) {
25 my $demolish = Mouse::Util::get_code_ref($class, 'DEMOLISH')
35 die $e if $e; # rethrow
42 return unless $self->can('BUILD');
44 for my $class (reverse $self->meta->linearized_isa) {
45 my $build = Mouse::Util::get_code_ref($class, 'BUILD')
57 return unless $self->can('DEMOLISH');
59 # We cannot count on being able to retrieve a previously made
60 # metaclass, _or_ being able to make a new one during global
61 # destruction. However, we should still be able to use mro at
62 # that time (at least tests suggest so ;)
64 foreach my $class (@{ Mouse::Util::get_linear_isa(ref $self) }) {
65 my $demolish = Mouse::Util::get_code_ref($class, 'DEMOLISH')
79 Mouse::Object - The base object for Mouse classes
83 This document describes Mouse version 0.40_05
87 =head2 C<< new (Arguments) -> Object >>
89 Instantiates a new C<Mouse::Object>. This is obviously intended for subclasses.
91 =head2 C<< BUILDARGS (Arguments) -> HashRef >>
93 Lets you override the arguments that C<new> takes. Return a hashref of
96 =head2 C<< BUILDALL (\%args) >>
98 Calls C<BUILD> on each class in the class hierarchy. This is called at the
101 =head2 C<< BUILD (\%args) >>
103 You may put any business logic initialization in BUILD methods. You don't
104 need to redispatch or return any specific value.
106 =head2 C<< DEMOLISHALL >>
108 Calls C<DEMOLISH> on each class in the class hierarchy. This is called at
111 =head2 C<< DEMOLISH >>
113 You may put any business logic deinitialization in DEMOLISH methods. You don't
114 need to redispatch or return any specific value.
117 =head2 C<< does ($role_name) -> Bool >>
119 This will check if the invocant's class B<does> a given C<$role_name>.
120 This is similar to "isa" for object, but it checks the roles instead.
122 =head2 C<<dump ($maxdepth) -> Str >>
126 C'mon, how many times have you written the following code while debugging:
131 It can get seriously annoying, so why not just use this.
133 The implementation was lifted directly from Moose::Object.