Skip Menu |

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

Report information
The Basics
Id: 113885
Status: open
Priority: 0/
Queue: MooseX-ClassAttribute

People
Owner: Nobody in particular
Requestors: DAKKAR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.27
Fixed in: (no value)



Subject: applying a role twice produces class attribute conflicts
See the attached test case. Role1 and Role2 each define a different class attribute. Applying them both to a class works. Applying Role1 to Role2, and Role2 to the class, works. Applying Role1 to Role2, and *both* to the class, fails. The same test passes if we don't use class attributes, but normal attributes.
Subject: role-role-class-composition.t
#!perl use strict; use warnings; use Test::More; package Role1;{ use Moose::Role; use MooseX::ClassAttribute; class_has one => (is => 'rw'); }; package Role2_with1;{ use Moose::Role; use MooseX::ClassAttribute; with qw(Role1); class_has two => (is => 'rw'); }; package Role2_without1;{ use Moose::Role; use MooseX::ClassAttribute; class_has two => (is => 'rw'); }; package main; sub run_one_test { my ($name,@roles) = @_; my $code = qq{package $name;use Moose; with qw(@roles);1;}; ok( eval($code), 'compiling the code should work', ); for my $accessor (qw(one two)) { ok( $name->can($accessor), "the class should have the ->$accessor accessor", ); } } subtest 'each role applied once' => sub { run_one_test(BothOnce=>qw(Role1 Role2_without1)); }; subtest 'role applied to role' => sub { run_one_test(RoleRole=>qw(Role2_with1)); }; subtest 'role applied to role and class' => sub { run_one_test(RoleRoleClass=>qw(Role1 Role2_with1)); }; done_testing;
On Tue Apr 19 06:52:46 2016, DAKKAR wrote: Show quoted text
> See the attached test case. > > Role1 and Role2 each define a different class attribute. > > Applying them both to a class works. > > Applying Role1 to Role2, and Role2 to the class, works. > > Applying Role1 to Role2, and *both* to the class, fails. > > The same test passes if we don't use class attributes, but normal > attributes.
I'm not really using this module any more, nor do I plan to in the future. Want comaint?