Skip Menu |
 

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 41919
Status: rejected
Priority: 0/
Queue: Moose

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

Bug Information
Severity: Unimportant
Broken in: 0.63
Fixed in: (no value)



Subject: Unexpected behavior for Moose::Util::MetaRole get_attribute_map
Download (untitled) / with headers
text/plain 990b
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
Subject: Re: [rt.cpan.org #41919] Unexpected behavior for Moose::Util::MetaRole get_attribute_map
Date: Tue, 23 Dec 2008 20:15:07 -0600 (CST)
To: Christopher Brown via RT <bug-Moose [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
Download (untitled) / with headers
text/plain 762b
On Tue, 23 Dec 2008, Christopher Brown via RT wrote: Show quoted text
> 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.
The get_attribute_map only method returns the attributes defined in the metaclass's class, not its parents (or parents' roles). -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.