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) = @_;
$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