More compatibility
[gitmo/Mouse.git] / lib / Mouse / Meta / Class.pm
index 1220d29..afc6f57 100644 (file)
@@ -11,6 +11,9 @@ our @ISA = qw(Mouse::Meta::Module);
 sub method_metaclass()    { 'Mouse::Meta::Method'    }
 sub attribute_metaclass() { 'Mouse::Meta::Attribute' }
 
+sub constructor_class()   { 'Mouse::Meta::Method::Constructor' }
+sub destructor_class()    { 'Mouse::Meta::Method::Destructor'  }
+
 sub _construct_meta {
     my($class, %args) = @_;
 
@@ -256,13 +259,13 @@ sub make_immutable {
     $self->{is_immutable}++;
 
     if ($args{inline_constructor}) {
-        # generate and install
-        Mouse::Meta::Method::Constructor->_generate_constructor_method($self, \%args);
+        $self->add_method($args{constructor_name} =>
+            $self->constructor_class->_generate_constructor($self, \%args));
     }
 
     if ($args{inline_destructor}) {
-        # generate and install
-        Mouse::Meta::Method::Destructor->_generate_destructor_method($self, \%args);
+        $self->add_method(DESTROY =>
+            $self->destructor_class->_generate_destructor($self, \%args));
     }
 
     # Moose's make_immutable returns true allowing calling code to skip setting an explicit true value