Hi
I'm trying to figure out how to combine the combination of CGI::Application,
MooseX::Decare and Roles in my CGI:App controller base class.A quick Google
gave me the solution for using the first two at
http://stackoverflow.com/questions/1060470/turning-off-inline-constructors-with-moosexdeclare/1061789#1061789:
use MooseX::Declare;
class MyApp::CGI extends CGI::Application is mutable {
around new {
my $obj = $self->SUPER::new( @_ );
return $self->meta->new_object( __INSTANCE__ => $obj, @_ );
}
method setup {
$self->start_mode( 'main' );
my @methods = map { $_->name } $self->meta->get_all_methods;
$self->run_modes( map { /^rm_(.+)$/ => $_ }
grep { /^rm_/ }
@methods
);
}
__PACKAGE__->meta->make_immutable( inline_constructor => 0 );
}
However, I want to add roles to my base class, but any sub-class blows up
with: "The 'add_method' method cannot be called on an immutable instance."
Suggestions to get around this are appreciated
Dan