Subject: | warnings when composing a role with MooseX::Traits in a class using MooseX::SemiAffordanceAccessor |
$ cat a.pl
#!/usr/bin/perl
use 5.010;
use C;
my $foo = C->new_with_traits(traits=>['R']);
say $foo->foo;
$ cat C.pm
package C;
use Moose;
use MooseX::AttributeHelpers;
use MooseX::SemiAffordanceAccessor;
with 'MooseX::Traits';
sub foo { 10 }
1;
$ cat R.pm
package R;
use Moose::Role;
around foo => sub { 42 };
no Moose::Role;
1;
$ ./a.pl
Attribute (_trait_namespace) of class C has no associated methods (did
you mean to provide an "is" argument?)
at /usr/lib/perl5/vendor_perl/5.10.0/Moose/Meta/Attribute.pm line 565
Moose::Meta::Attribute::_check_associated_methods('Class::MOP::Class::__ANON__::SERIAL::1=HASH(0x2678838)')
called at /usr/lib/perl5/vendor_perl/5.10.0/Moose/Meta/Class.pm line 253
Moose::Meta::Class::add_attribute('Moose::Meta::Class=HASH(0x23fd610)',
'_trait_namespace', 'HASH(0x267b8f0)') called at
/usr/lib/perl5/vendor_perl/5.10.0/Moose/Meta/Role/Application/ToClass.pm
line 122
Moose::Meta::Role::Application::ToClass::apply_attributes('Moose::Meta::Role::Application::ToClass=HASH(0x22fb018)',
'Moose::Meta::Role=HASH(0x264f060)',
'Moose::Meta::Class=HASH(0x23fd610)') called at
/usr/lib/perl5/vendor_perl/5.10.0/Moose/Meta/Role/Application.pm line 62
Moose::Meta::Role::Application::apply('Moose::Meta::Role::Application::ToClass=HASH(0x22fb018)',
'Moose::Meta::Role=HASH(0x264f060)',
'Moose::Meta::Class=HASH(0x23fd610)') called at
/usr/lib/perl5/vendor_perl/5.10.0/Moose/Meta/Role/Application/ToClass.pm
line 31
Moose::Meta::Role::Application::ToClass::apply('Moose::Meta::Role::Application::ToClass=HASH(0x22fb018)',
'Moose::Meta::Role=HASH(0x264f060)',
'Moose::Meta::Class=HASH(0x23fd610)') called at
/usr/lib/perl5/vendor_perl/5.10.0/Moose/Meta/Role.pm line 487
Moose::Meta::Role::apply('Moose::Meta::Role=HASH(0x264f060)',
'Moose::Meta::Class=HASH(0x23fd610)') called at
/usr/lib/perl5/vendor_perl/5.10.0/Moose/Util.pm line 117
Moose::Util::_apply_all_roles('Moose::Meta::Class=HASH(0x23fd610)',
'CODE(0x1fb80c8)', 'MooseX::Traits') called at
/usr/lib/perl5/vendor_perl/5.10.0/Moose/Util.pm line 82
Moose::Util::apply_all_roles('Moose::Meta::Class=HASH(0x23fd610)',
'MooseX::Traits') called at /usr/lib/perl5/vendor_perl/5.10.0/Moose.pm
line 56
Moose::with('C', 'MooseX::Traits') called at
/usr/lib/perl5/vendor_perl/5.10.0/Moose/Exporter.pm line 320
Moose::with('MooseX::Traits') called at C.pm line 6
require C.pm called at ./a.pl line 3
main::BEGIN() called at C.pm line 0
eval {...} called at C.pm line 0
42
commenting out "use MooseX::SemiAffordanceAccessor;" in C.pm get rids of
the warnings.