Subject: | BUILD modifier role composition bug |
{
package ModifierRole;
use Moo::Role;
sub BUILD { }
after BUILD => sub {
print "fired\n";
};
}
{
package ModifierProxyRole;
use Moo::Role;
with 'ModifierRole';
}
{
package SharedRole;
use Moo::Role;
with 'ModifierProxyRole';
}
{
package Role1;
use Moo::Role;
with 'SharedRole';
}
{
package Role2;
use Moo::Role;
with 'SharedRole';
}
{
package DoubleRole;
use Moo::Role;
with qw(Role1 Role2);
}
{
package Base;
use Moo;
with 'DoubleRole';
}
use Base;
Base->new;
=begin
[/tmp/moo] $ perl test.pl
fired
fired
:%s/Moo/Moose/g
[/tmp/moo] $ perl test.pl
fired
=cut
BUILD modifier fires twice in Moo, once in Moose. Have only tested in 2.00002. example is a reduction of current Message::Passing::AMQP hierarchy.
thanks