}
else {
Class::MOP::load_class( $role->[0] , $role->[1] );
- $meta = Class::MOP::class_of( $role->[0] );
+ $meta = find_meta( $role->[0] );
}
unless ($meta && $meta->isa('Moose::Meta::Role') ) {
return unless @role_metas;
- my $meta = ( blessed $applicant ? $applicant : find_meta($applicant) );
+ my $meta = ( blessed $applicant ? $applicant : Moose::Meta::Class->initialize($applicant) );
if ( scalar @role_metas == 1 ) {
my ( $role, $params ) = @{ $role_metas[0] };
with 'FooRole', 'BarRole';
}
+{
+ package PlainJane;
+ sub new { return bless {}, __PACKAGE__; }
+}
+
my $foo_class_meta = FooClass->meta;
isa_ok( $foo_class_meta, 'Moose::Meta::Class' );
}
}
+{
+ ok(!Moose::Util::find_meta('PlainJane'), 'not initialized');
+ Moose::Util::apply_all_roles('PlainJane', 'BarRole');
+ ok(Moose::Util::find_meta('PlainJane'), 'initialized');
+ ok(Moose::Util::find_meta('PlainJane')->does_role('BarRole'), 'does BarRole');
+ my $pj = PlainJane->new();
+ ok($pj->can('woot'), 'can woot');
+}
+
done_testing;