Subject: | Bug in parameterized role composition |
Date: | Sat, 01 May 2010 00:26:09 +0200 |
To: | bug-MooseX-Declare [...] rt.cpan.org |
From: | Tarcisio Fedrizzi <tarcisio.fedrizzi [...] gmail.com> |
Hi,
I have found a problem when applying a parameterized role
that has a variable.
The attached program buggy_program.pl fails to execute
with the following error:
Role 'Moose::Meta::Role::__ANON__::SERIAL::4' has encountered an
attribute conflict during composition. This is fatal error and cannot be
disambiguated. at /usr/lib/perl5/Moose/Meta/Role/Application/ToRole.pm
line 61
Moose::Meta::Role::Application::ToRole::apply_attributes('Moose::Meta::Role::Application::ToRole=HASH(0x2bbc540)',
'MooseX::Role::Parameterized::Meta::Role::Parameterized=HASH(0...',
'MooseX::Role::Parameterized::Meta::Role::Parameterizable=HASH...')
called at /usr/lib/perl5/Moose/Meta/Role/Application.pm line 72
Moose::Meta::Role::Application::apply('Moose::Meta::Role::Application::ToRole=HASH(0x2bbc540)',
'MooseX::Role::Parameterized::Meta::Role::Parameterized=HASH(0...',
'MooseX::Role::Parameterized::Meta::Role::Parameterizable=HASH...')
called at /usr/lib/perl5/Moose/Meta/Role/Application/ToRole.pm line 17
Moose::Meta::Role::Application::ToRole::apply('Moose::Meta::Role::Application::ToRole=HASH(0x2bbc540)',
'MooseX::Role::Parameterized::Meta::Role::Parameterized=HASH(0...',
'MooseX::Role::Parameterized::Meta::Role::Parameterizable=HASH...')
called at /usr/lib/perl5/Moose/Meta/Role.pm line 419
Moose::Meta::Role::apply('MooseX::Role::Parameterized::Meta::Role::Parameterized=HASH(0...',
'MooseX::Role::Parameterized::Meta::Role::Parameterizable=HASH...',
'test', 'asd') called at
/usr/share/perl5/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm
line 121
MooseX::Role::Parameterized::Meta::Role::Parameterizable::apply('MooseX::Role::Parameterized::Meta::Role::Parameterizable=HASH...',
'MooseX::Role::Parameterized::Meta::Role::Parameterizable=HASH...',
'test', 'asd') called at /usr/lib/perl5/Moose/Util.pm line 132
Moose::Util::_apply_all_roles('TestTestRole', undef,
'TestRole', 'HASH(0x2bb2498)') called at /usr/lib/perl5/Moose/Util.pm
line 86
Moose::Util::apply_all_roles('TestTestRole', 'TestRole',
'HASH(0x2bb2498)') called at
/usr/share/perl5/MooseX/Declare/Syntax/Keyword/With.pm line 23
MooseX::Declare::Syntax::Keyword::With::__ANON__('TestRole',
'HASH(0x2bb2498)') called at buggy_program.pl line 25
TestTestRole::__ANON__('Class::MOP::Class::__ANON__::SERIAL::11=HASH(0x2baa878)',
'operating_on',
'MooseX::Role::Parameterized::Meta::Role::Parameterized=HASH(0...',
'consumer', 'Moose::Meta::Class=HASH(0x2b9a010)') called at
/usr/share/perl5/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm
line 94
MooseX::Role::Parameterized::Meta::Role::Parameterizable::generate_role('MooseX::Role::Parameterized::Meta::Role::Parameterizable=HASH...',
'consumer', 'Moose::Meta::Class=HASH(0x2b9a010)', 'parameters',
'HASH(0x29d08b0)') called at
/usr/share/perl5/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm
line 116
MooseX::Role::Parameterized::Meta::Role::Parameterizable::apply('MooseX::Role::Parameterized::Meta::Role::Parameterizable=HASH...',
'Moose::Meta::Class=HASH(0x2b9a010)', 'test', 'casda') called at
/usr/lib/perl5/Moose/Util.pm line 132
Moose::Util::_apply_all_roles('Test2', undef, 'TestTestRole',
'HASH(0x160b790)') called at /usr/lib/perl5/Moose/Util.pm line 86
Moose::Util::apply_all_roles('Test2', 'TestTestRole',
'HASH(0x160b790)') called at
/usr/share/perl5/MooseX/Declare/Syntax/Keyword/With.pm line 23
MooseX::Declare::Syntax::Keyword::With::__ANON__('TestTestRole',
'HASH(0x160b790)') called at buggy_program.pl line 44
Test2::__ANON__() called at
/usr/share/perl5/MooseX/Declare/Syntax/MooseSetup.pm line 66
MooseX::Declare::Syntax::MooseSetup::__ANON__('CODE(0x2b76c48)') called
at buggy_program.pl line 45
If you comment the variable definition in the TestRole role everything
works correctly. Moreover the bug
is produced only if both the roles are parameterized and only with a
hierarchy at least two (I haven't tested more) roles.
The equivalent program same_no_declare.pl that does not make use of
MooseX::Declare runs correctly.
The version of my perl distribution is 5.10.1.
The version of MooseX::Declare is 0.33
Here you have my uname -a string "Linux localhost 2.6.31 #1 SMP Sun Dec
27 11:21:43 CET 2009 x86_64 GNU/Linux",
the os is a debian.
Bye,
Tarcisio Fedrizzi
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.