Subject: | Unexpected behavior for Moose::Util::MetaRole get_attribute_map |
If you consume a role using Moose::Util::MetaRole::apply_base_class_role
and the role specifies an attribute, that attribute will not appear in
the lists of the attributes for that class. For example:
package MyExt;
...
sub init_meta {
...
Moose::Util::MetaRole::apply_base_class_roles(
for_class => $options{for_class},
roles => [ 'MyRole' ] ,
);
}
package MyRole;
use Moose::Role;
has 'key' => ( is => 'rw', isa => 'Str', default => 'yes' );
package MyApp;
use Moose;
use MyExt;
package main;
my $o = MyApp->new();
print "The list of attributes is:\n\t" ,
join "\n\t", keys %{ $o->meta->get_attribute_map } ,
"\n";
I would expect to see key as an attribute, it is not. I suspect this has
something to do with the apply_base_class_role.
Best Wishes,
Chris