From: Tokuhiro Matsuno Date: Sat, 6 Dec 2008 06:01:57 +0000 (+0000) Subject: always inject method to DESTROY X-Git-Tag: 0.19~136^2~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0a0814d61119dcfd7f2cd88c3658df7221e17219;p=gitmo%2FMouse.git always inject method to DESTROY --- diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index cd8766a..966c27d 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -146,11 +146,7 @@ sub make_immutable { $self->{is_immutable}++; no strict 'refs'; *{"$name\::new"} = Mouse::Meta::Method::Constructor->generate_constructor_method_inline( $self ); - - my $destructor = Mouse::Meta::Method::Destructor->generate_destructor_method_inline( $self ); - if ($destructor) { - *{"$name\::DESTROY"} = $destructor; - } + *{"$name\::DESTROY"} = Mouse::Meta::Method::Destructor->generate_destructor_method_inline( $self ); } sub make_mutable { Carp::croak "Mouse::Meta::Class->make_mutable does not supported by Mouse"; diff --git a/lib/Mouse/Meta/Method/Destructor.pm b/lib/Mouse/Meta/Method/Destructor.pm index 935be3b..bdcbe1f 100644 --- a/lib/Mouse/Meta/Method/Destructor.pm +++ b/lib/Mouse/Meta/Method/Destructor.pm @@ -16,7 +16,7 @@ sub generate_destructor_method_inline { } join "\n", @code; } else { - return 'sub { }'; # no demolish =) + return sub { }; # no demolish =) } };