1use strict; 2use warnings; 3use Test::More tests => 6; 4 5{ 6 package MouseClass; 7 use Carp; # import external functions (not our methods) 8 use Mouse; 9 sub foo { } 10 no Mouse; 11} 12{ 13 package MouseClassImm; 14 use Carp; # import external functions (not our methods) 15 use Mouse; 16 sub foo { } 17 no Mouse; 18 __PACKAGE__->meta->make_immutable(); 19} 20{ 21 package MouseRole; 22 use Carp; # import external functions (not our methods) 23 use Mouse::Role; 24 sub bar { } 25 no Mouse::Role; 26} 27{ 28 package MouseRoleWithoutNoMouseRole; 29 use Mouse::Role; 30 31 sub baz { } 32 # without no Mouse::Role; 33} 34{ 35 package MouseClassWithRole; 36 use Mouse; 37 38 with 'MouseRole'; 39 no Mouse; 40} 41{ 42 package MouseClassWithRoles; 43 use Mouse; 44 45 with qw(MouseRole MouseRoleWithoutNoMouseRole); 46} 47 48is join(',', sort MouseClass->meta->get_method_list()), 'foo,meta', "mutable Mouse"; 49is join(',', sort MouseClassImm->meta->get_method_list()), 'DESTROY,foo,meta,new', "immutable Mouse"; 50 51is join(',', sort MouseRole->meta->get_method_list()), 'bar,meta', "role Mouse"; 52is join(',', sort MouseRoleWithoutNoMouseRole->meta->get_method_list()), 53 'baz,meta', "role Mouse"; 54 55is join(',', sort MouseClassWithRole->meta->get_method_list()), 56 'bar,meta', "Mouse with a role"; 57is join(',', sort MouseClassWithRoles->meta->get_method_list()), 58 'bar,baz,meta', "Mouse with roles"; 59 60 61