On Tue Dec 21 07:46:18 2010, enquiries@mikeraynham.co.uk wrote:
Show quoted text> This may be the same issue as bug #59610 and #59572, so please accept my
> apologies if that is the case.
>
> When consuming roles that use MooseX::ClassAttribute, the relevant class
> attribute methods are not added if a list is supplied to the 'with'
> function. However, it works correctly if two separate calls are made to
> the 'with' function.
>
> See MyApp::Compose vs MyApp::ComposeList, here:
>
>
http://paste.scsys.co.uk/61229
As requested, I have attached a failing test case:
09-role-composition-list.t
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 4;
{
package RoleA;
use Moose::Role;
use MooseX::ClassAttribute;
use namespace::autoclean;
class_has attrib_a => ( is => 'rw', default => 'a' );
}
{
package RoleB;
use Moose::Role;
use MooseX::ClassAttribute;
use namespace::autoclean;
class_has attrib_b => ( is => 'rw', default => 'b' );
}
{
package ComposeSeparate;
use Moose;
use namespace::autoclean;
with 'RoleA';
with 'RoleB';
__PACKAGE__->meta->make_immutable;
}
{
package ComposeList;
use Moose;
use namespace::autoclean;
with qw( RoleA RoleB );
__PACKAGE__->meta->make_immutable;
}
is( ComposeSeparate->attrib_a, 'a', "ComposeSeparate->attrib_a == 'a'" );
is( ComposeSeparate->attrib_b, 'b', "ComposeSeparate->attrib_b == 'b'" );
is( ComposeList->attrib_a, 'a', "ComposeList->attrib_a == 'a'" );
is( ComposeList->attrib_b, 'b', "ComposeList->attrib_b == 'b'" );
done_testing();