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.