10 package MyExporterRole;
15 Moose::Exporter->setup_import_methods(
20 my ($class,%args) = @_;
22 my $meta = Moose->init_meta( %args );
24 Moose::Util::MetaRole::apply_metaroles(
27 class => ['MyMetaRole'],
34 $INC{'MyExporterRole.pm'} = __FILE__;
41 sub some_meta_class_method {
50 sub some_meta_class_method_defined_by_trait {
55 package Moose::Meta::Class::Custom::Trait::MyClassTrait;
58 sub register_implementation { return 'MyTrait' }
64 use MyExporterRole -traits => 'MyClassTrait';
69 my $my_class = MyClass->new;
71 isa_ok($my_class,'MyClass');
73 my $meta = $my_class->meta();
74 # Check if MyMetaRole has been applied
75 ok($meta->can('some_meta_class_method'),'Meta class has some_meta_class_method');
76 # Check if MyTrait has been applied
77 ok($meta->can('some_meta_class_method_defined_by_trait'),'Meta class has some_meta_class_method_defined_by_trait');