Bug fix: DESTROY was being overridden by make_immutable.
Dylan William Hardison [Thu, 11 Jun 2009 14:57:08 +0000 (14:57 +0000)]
lib/Class/MOP/Class.pm

index d2dfd10..237023b 100644 (file)
@@ -1204,6 +1204,13 @@ sub _inline_destructor {
         || confess "The 'inline_destructor' option is present, but "
         . "no destructor class was specified";
 
+    if ($self->has_method('DESTROY') ) {
+        my $class = $self->name;
+        warn "Not inlining a destructor for $class since it defines"
+            . " its own destructor.\n";
+        return;
+    }
+
     my $destructor_class = $args{destructor_class};
 
     Class::MOP::load_class($destructor_class);