always inject method to DESTROY
Tokuhiro Matsuno [Sat, 6 Dec 2008 06:01:57 +0000 (06:01 +0000)]
lib/Mouse/Meta/Class.pm
lib/Mouse/Meta/Method/Destructor.pm

index cd8766a..966c27d 100644 (file)
@@ -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";
index 935be3b..bdcbe1f 100644 (file)
@@ -16,7 +16,7 @@ sub generate_destructor_method_inline {
             }
             join "\n", @code;
         } else {
-            return 'sub { }'; # no demolish =)
+            return sub { }; # no demolish =)
         }
     };