Subject: | make_immutable breaks methods using _call_kernel_from_my_session |
When __PACKAGE__->meta->make_immutable; is called from a module using
MooseX::POE (as is recommended by Moose Best Practices), the "new"
method provided by MooseX::POE::Meta::Trait::Object to replace the
default Moose-provided constructor will not be executed any longer.
It seems that MooseX::POE::Meta::Trait::Constructor partially implements
the behavior needed for MooseX::POE to function after make_immutable. A
functional POE session is created and START methods are called as expected.
However, this method of POE session creation does not register a hook
for _call_kernel_from_my_session, which turns all the various helper
methods defined by MooseX::POE::Meta::Trait::Object into no-ops.
I have attached a test case which should say "test" every second. It
exits immediately. If make_immutable is commented out, it works.
Subject: | moosex-poe-make-immutable.pl |
{
package mxp;
use MooseX::POE;
sub START
{
$_[0]->delay('test', 1);
}
event 'test' => sub
{
print STDERR "test\n";
$_[0]->delay('test', 1);
};
__PACKAGE__->meta->make_immutable;
};
{
package main;
use POE;
my $mxp = mxp->new;
POE::Kernel->run;
};
1;