2 use warnings FATAL => 'all';
7 plan skip_all => "Class::Method::Modifiers not installed or too old"
8 unless eval "use Class::Method::Modifiers 1.05; 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->(@_) };
58 sub foo { 'class foo' }
63 exception { Role::Tiny->apply_role_to_package($to, 'MyRole') }
66 is(try_apply_to('MyClass'), undef, 'role applies cleanly');
67 is(MyClass->foo, 'role foo class foo', 'method modifier');
68 is(ExtraClass->foo, 'role foo class foo', 'method modifier with composition');
70 is(ExtraClass2->foo, 'role foo class foo',
71 'method modifier with role composed into role');
74 my $new_class = Role::Tiny->create_class_with_roles('MyClass', 'BrokenRole');
75 }, 'exception caught creating class with broken modifier in a role');