Consider the following:
package MyApp::CGI;
use Moose;
use MooseX::NonMoose;
use Data::Dumper;
extends 'CGI::Application';
BEGIN {
print "begin isa = " . Dumper \@MyApp::CGI::ISA;
};
print "runtime isa = " . Dumper \@MyApp::CGI::ISA;
...
The output when this compiles is:
begin isa = $VAR1 = [
'Moose::Object'
];
runtime isa = $VAR1 = [
'CGI::Application',
'Moose::Object'
];
Why do I care? Because when I try to use
a CGI::Application::Plugin::* class, it expects me to be inheriting from CGI::Application
at compile-time already. The plugin class tries to call add_callback
as a class method on my class, but can't, because my @ISA
isn't set up yet.
What's the best way to solve this? Would tweaking @ISA
manually in a BEGIN
block interfere with MooseX::NonMoose
?
Edit
The following appears to work, but I find it offensive:
package MyApp::CGI;
use Moose;
use MooseX::NonMoose;
use base 'CGI::Application';
extends 'CGI::Application';
I don't know enough (or anything, really) about Moose internals to know if this is a good idea.