use Test::Most 'die'; use Role::Tiny; package MyClass { # standing in for the real consumer of the role, # which is expensive to instantiate in some way ... use Moo; }; package MyRole { use Moo::Role; sub foo { 42 } }; subtest 'Applying' => sub { my $o = MyClass->new; is( ref $o, 'MyClass', 'object instantiated' ); ok( Role::Tiny->apply_roles_to_object($o, 'MyRole'), 'role applied' ); is( $o->foo, 42, 'method in Role works!' ); }; done_testing;