From: Graham Knop Date: Fri, 12 Jul 2013 02:12:41 +0000 (-0400) Subject: check requires before installing modifiers X-Git-Tag: v1.003000~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c0978659eb62dce7d946dd78b0fd1a720947be99;p=gitmo%2FRole-Tiny.git check requires before installing modifiers --- diff --git a/lib/Role/Tiny.pm b/lib/Role/Tiny.pm index a1a0ec6..21688d4 100644 --- a/lib/Role/Tiny.pm +++ b/lib/Role/Tiny.pm @@ -74,7 +74,7 @@ sub import { } sub role_application_steps { - qw(_install_methods _install_modifiers _check_requires _copy_applied_list); + qw(_install_methods _check_requires _install_modifiers _copy_applied_list); } sub apply_single_role_to_package { diff --git a/t/compose-modifiers.t b/t/compose-modifiers.t index 8357d05..0dde333 100644 --- a/t/compose-modifiers.t +++ b/t/compose-modifiers.t @@ -34,4 +34,21 @@ foreach my $combo ( is(ref($object), $combined, 'Object reblessed into correct class'); } +{ + package Five; use Role::Tiny; + requires 'bar'; + around bar => sub { my $orig = shift; $orig->(@_) }; +} +{ + is eval { + package WithFive; + use Role::Tiny::With; + use base 'Base'; + with 'Five'; + }, undef, + "composing an around modifier fails when method doesn't exist"; + like $@, qr/Can't apply Five to WithFive - missing bar/, + ' ... with correct error message'; +} + done_testing;