From: Shawn M Moore Date: Tue, 10 Feb 2009 01:23:39 +0000 (+0000) Subject: Throw a better error message when using a method modifier without CMM X-Git-Tag: 0.19~34 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1b79a118d069013b10af19f7b3c35031eb4af816;p=gitmo%2FMouse.git Throw a better error message when using a method modifier without CMM --- diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index 3ee836c..b9179eb 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -195,8 +195,7 @@ sub _install_modifier { $code ); } - else { - require Class::Method::Modifiers; + elsif (eval "require Class::Method::Modifiers; 1") { Class::Method::Modifiers::_install_modifier( $into, $type, @@ -204,6 +203,9 @@ sub _install_modifier { $code ); } + else { + Carp::croak("Method modifiers require the use of Class::Method::Modifiers. Please install it from CPAN and file a bug report with this application."); + } } sub add_before_method_modifier {