From: Matt S Trout Date: Fri, 1 Feb 2013 18:59:21 +0000 (+0000) Subject: complain loudly if Class::Method::Modifiers is too old (and skip tests) X-Git-Tag: v1.002005~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3117a19eae72e3b1f2af43456ebf52a880593f9b;p=gitmo%2FRole-Tiny.git complain loudly if Class::Method::Modifiers is too old (and skip tests) --- diff --git a/Changes b/Changes index 138d373..c8c6693 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,4 @@ + - complain loudly if Class::Method::Modifiers is too old (and skip tests) - don't use $_ as loop variable when calling arbitrary code 1.002004 - 2012-11-02 diff --git a/lib/Role/Tiny.pm b/lib/Role/Tiny.pm index 9a3ce29..6f6a97d 100644 --- a/lib/Role/Tiny.pm +++ b/lib/Role/Tiny.pm @@ -314,8 +314,17 @@ sub _install_modifiers { } } +my $vcheck_error; + sub _install_single_modifier { my ($me, @args) = @_; + defined($vcheck_error) or $vcheck_error = do { + local $@; + eval { Class::Method::Modifiers->VERSION(1.05); 1 } + ? 0 + : $@ + }; + $vcheck_error and die $vcheck_error; Class::Method::Modifiers::install_modifier(@args); } diff --git a/t/around-does.t b/t/around-does.t index d2a5473..5522469 100644 --- a/t/around-does.t +++ b/t/around-does.t @@ -1,8 +1,8 @@ use Test::More; BEGIN { - plan skip_all => "Class::Method::Modifiers not installed" - unless eval "use Class::Method::Modifiers; 1"; + plan skip_all => "Class::Method::Modifiers not installed or too old" + unless eval "use Class::Method::Modifiers 1.05; 1"; } my $pass; diff --git a/t/compose-modifiers.t b/t/compose-modifiers.t index 882c4ea..8357d05 100644 --- a/t/compose-modifiers.t +++ b/t/compose-modifiers.t @@ -3,8 +3,8 @@ use warnings FATAL => 'all'; use Test::More; BEGIN { - plan skip_all => "Class::Method::Modifiers not installed" - unless eval "use Class::Method::Modifiers; 1"; + plan skip_all => "Class::Method::Modifiers not installed or too old" + unless eval "use Class::Method::Modifiers 1.05; 1"; } { diff --git a/t/modifiers.t b/t/modifiers.t index 8a3e1f1..63a9708 100644 --- a/t/modifiers.t +++ b/t/modifiers.t @@ -4,8 +4,8 @@ use Test::More; use Test::Fatal; BEGIN { - plan skip_all => "Class::Method::Modifiers not installed" - unless eval "use Class::Method::Modifiers; 1"; + plan skip_all => "Class::Method::Modifiers not installed or too old" + unless eval "use Class::Method::Modifiers 1.05; 1"; } BEGIN {