Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 98488
Status: resolved
Priority: 0/
Queue: Moose

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

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



Subject: use Moose -meta_name = '...'; does not work as advertised
{ package Qux; use Moose -meta_name => 'qux_meta'; } ok(!Qux->can('meta'), 'meta method is not available on Qux'); can_ok('Qux', 'qux_meta'); is(Qux->qux_meta, Class::MOP::class_of('Qux'), 'Qux is a class_of Qux, via Qux->qux_meta'); isa_ok(Qux->qux_meta->get_method('qux_meta'), 'Moose::Meta::Method::Meta'); not ok 1 - Qux->cant('meta') # Failed test 'Qux->cant('meta')' # at t/metaclasses/meta_name.t line 55. ok 2 - Qux->can('qux_meta') ok 3 - Qux is a class_of Qux, via Qux->qux_meta ok 4 - An object of class 'Moose::Meta::Method::Meta' isa 'Moose::Meta::Method::Meta' While the custom meta method is being added, a default 'meta' is also being added, which is not consistent with the documentation (and the point of this feature is to avoid conflicting with a class's existing 'meta' method, e.g. on RoseDB, so the documentation correctly describes the desired behaviour). I've added TODO test cases to t/metaclasses/meta_name.t.
There's no bug here AFAICT. The meta method is inherited from Moose::Object by default, which makes sense. However, if you rename the meta method with -meta_name *and* inherit from a parent with a different meta method, you get that parent's meta. I added some tests for all of this in https://github.com/moose/Moose/pull/90
On 2014-11-27 10:32:22, DROLSKY wrote: Show quoted text
> There's no bug here AFAICT. The meta method is inherited from > Moose::Object by default, which makes sense. However, if you rename > the meta method with -meta_name *and* inherit from a parent with a > different meta method, you get that parent's meta. > > I added some tests for all of this in > https://github.com/moose/Moose/pull/90
I think there's still a bug here, somewhere -- the point of -meta_name is to avoid getting a 'meta' sub, so how can the caller achieve that? At the very least, the documentation needs to properly describe this.
On Thu Nov 27 13:42:35 2014, ETHER wrote: Show quoted text
> On 2014-11-27 10:32:22, DROLSKY wrote:
> > There's no bug here AFAICT. The meta method is inherited from > > Moose::Object by default, which makes sense. However, if you rename > > the meta method with -meta_name *and* inherit from a parent with a > > different meta method, you get that parent's meta. > > > > I added some tests for all of this in > > https://github.com/moose/Moose/pull/90
> > > I think there's still a bug here, somewhere -- the point of -meta_name > is to avoid getting a 'meta' sub, so how can the caller achieve that? > > At the very least, the documentation needs to properly describe this.
Yeah, I agree that this should go in the docs. It'll "just work" for the use case where someone wants to subclass a non-Moose parent like Rose::DB, however.