Greetings,
As a followup to my previous question about Moose, I've now run into a new problem. I've got a Moose class which uses Recipe 12 in order to extend a non-Moose parent class. Here it is:
package MyApp::CGI;
### TODO: make this work with MooseX::Declare?
use Moose;
extends 'CGI::Application';
sub new {
my $class = shift;
my $obj = $class->SUPER::new( @_ );
return $class->meta->new_object( __INSTANCE__ => $obj, @_ );
}
sub setup {
my $self = shift;
$self->start_mode( 'main' );
my @methods = map { $_->name } $self->meta->get_all_methods;
$self->run_modes( map { /^rm_(.+)$/ => $_ }
grep { /^rm_/ }
@methods
);
}
This works great. I also have a subclass of this class which uses MooseX::Declare
. However, because I am now overriding the default Moose constructor, my subclass emits this warning:
Not inlining 'new' for MyApp::CGI::Login since it is not inheriting the default Moose::Object::new
If you are certain you don't need to inline your constructor, specify inline_constructor => 0 in your call to MyApp::CGI::Login->meta->make_immutable
Since MooseX::Declare
calls make_immutable
automatically behind the scenes, I haven't been able to figure out how to get it to turn on the inline_constructor => 0
parameter.