2 use warnings FATAL => 'all';
7 plan skip_all => "Class::Method::Modifiers not installed"
8 unless eval "use Class::Method::Modifiers; 1";
16 around foo => sub { my $orig = shift; join ' ', 'role foo', $orig->(@_) };
28 sub foo { 'class foo' }
36 with qw(MyRole ExtraRole);
38 sub foo { 'class foo' }
45 around 'broken modifier' => sub { my $orig = shift; $orig->(@_) };
50 exception { Role::Tiny->apply_role_to_package($to, 'MyRole') }
53 is(try_apply_to('MyClass'), undef, 'role applies cleanly');
54 is(MyClass->foo, 'role foo class foo', 'method modifier');
55 is(ExtraClass->foo, 'role foo class foo', 'method modifier with composition');
58 my $new_class = Role::Tiny->create_class_with_roles('MyClass', 'BrokenRole');
59 }, 'exception caught creating class with broken modifier in a role');