Skip Menu |
 

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 68529
Status: open
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: trlorenz [...] hotmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.0007
Fixed in: (no value)



Subject: Applying metarole via Moose::Util::MetaRole clobbers method modifiers.
Which is to say, if you have some role that implements method modifiers, and you apply some metarole to that role via Moose::Util::MetaRole, the role will appear to have lost its method modifiers when later applied to a class (or role). === { package SOME_ROLE; use Moose::Role; sub some_method { 'SOME_METHOD' } around some_method => sub { 'SOME_METHOD_WITH_MODIFIER' }; } { package SOME_CLASS; use Moose; with 'SOME_ROLE'; } say SOME_CLASS->new->some_method; # "SOME_METHOD_WITH_MODIFIER" { package SOME_METAROLE; use Moose::Role; } Moose::Util::MetaRole::apply_metaroles( for => 'SOME_ROLE', role_metaroles => {role => [qw(SOME_METAROLE)]}, ); { package SOME_OTHER_CLASS; use Moose; with 'SOME_ROLE'; } say SOME_OTHER_CLASS->new->some_method; # "SOME_METHOD" === I assume this is a bug since the behavior's not documented (that I could find), but I'm not sure. Also I'm not sure whether Moose::Util::MetaRole is the faulty layer. Thanks, guys. === Moose 2.0007 Perl 5.12.1 (Strawberry) Windows 7
Download (untitled) / with headers
text/plain 290b
Yes, this is an issue with Moose::Util::MetaRole - it's basically the same bug as #66866, just with methods instead of attributes. We intend to fix this in the future, but for right now, you will need to apply metaroles before doing anything with attributes or methods in the class or role.


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.