Skip Menu |

This queue is for tickets about the MooseX-ClassAttribute CPAN distribution.

Report information
The Basics
Id: 59572
Status: resolved
Priority: 0/
Queue: MooseX-ClassAttribute

People
Owner: Nobody in particular
Requestors: enquiries [...] mikeraynham.co.uk
ether [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.16
Fixed in: 0.23



Subject: Delegated methods are not added properly when composed from a role in some circumstances
When a role is composed from a list, and is not the first role in the list, delegated methods are not properly added to the class. See t/07-role-composition-of-delegates.t in branch topic/delegation_bugs.
Subject: MooseX::ClassAttribute, Roles and 'with'
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
From: enquiries [...] mikeraynham.co.uk
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
Subject: 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();