Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: mjd [...] plover.com
Cc:
AdminCc:

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



CC: rjbs [...] icgroup.com, mjd [...] icgroup.com
Subject: Moose::Exporter's importer destroys role generator
Date: Thu, 24 Mar 2011 15:45:39 -0400
To: bug-moose [...] rt.cpan.org
From: Mark Jason Dominus <mjd [...] plover.com>
This fails with the following version combinations: MooseX::Role::Parameterized Moose 0.23 1.21 0.25 1.21 0.25 1.24 The working version should *not* die with "Where did my role generator go??"/ ================================================================ package DummyRole; use Moose::Role; package Bar; use Moose (); use Moose::Exporter; Moose::Exporter->setup_import_methods( role_metaroles => { role => [ 'DummyRole' ] }, ); package Foo; use MooseX::Role::Parameterized; parameter 'message'; role { my ($p) = @_; warn "My role generator is now ", Foo->meta->{role_generator}, "\n"; Bar->import(); unless (exists Foo->meta->{role_generator}) { warn "Where did my role generator go??\n"; exit 1; } }; package main; use Moose; with Foo => { };
This is because the metaclass for the parameterizable role is being reinitialized, and so the attributes on that metaclass are being reset. As mentioned on #moose though, you really should be doing Foo->import({into => $args{operating_on}->name}), to apply the metaroles to the parameterized role, not the parameterizable role. This should really be made easier, but that's really something that MooseX::Role::Parameterized needs to do itself; it's not really directly a Moose issue. Whether or not metarole application should cause reinitialization (clearing out the existing contents of the metaclass) is something that's worth discussing in general though, so I'll leave this open for now.