From: Jesse Luehrs Date: Sat, 14 Feb 2009 01:22:10 +0000 (+0000) Subject: always call DEMOLISHALL, so that method modifiers work properly on it X-Git-Tag: 0.70~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cb5c79c9b4d83e6dd3981cdf0947b8dade7edc75;p=gitmo%2FMoose.git always call DEMOLISHALL, so that method modifiers work properly on it --- diff --git a/lib/Moose/Object.pm b/lib/Moose/Object.pm index 2c84d95..9b0817a 100644 --- a/lib/Moose/Object.pm +++ b/lib/Moose/Object.pm @@ -49,16 +49,16 @@ sub BUILDALL { sub DEMOLISHALL { my $self = shift; + # NOTE: we ask Perl if we even + # need to do this first, to avoid + # extra meta level calls + return unless $self->can('DEMOLISH'); foreach my $method ($self->meta->find_all_methods_by_name('DEMOLISH')) { $method->{code}->execute($self); } } sub DESTROY { - # NOTE: we ask Perl if we even - # need to do this first, to avoid - # extra meta level calls - return unless $_[0]->can('DEMOLISH'); # if we have an exception here ... if ($@) { # localize the $@ ...