From: gfx Date: Fri, 12 Feb 2010 12:57:04 +0000 (+0900) Subject: Add an arg check to appply_metaroles() X-Git-Tag: 0.50_01~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=add53fbe34ef5360a8474ac4a1aa6914217abe56 Add an arg check to appply_metaroles() --- diff --git a/lib/Mouse/Util/MetaRole.pm b/lib/Mouse/Util/MetaRole.pm index 8334bd5..1b29b60 100644 --- a/lib/Mouse/Util/MetaRole.pm +++ b/lib/Mouse/Util/MetaRole.pm @@ -16,6 +16,10 @@ sub apply_metaroles { ? $args{for} : Mouse::Util::get_metaclass_by_name( $args{for} ); + if(!$for){ + Carp::confess("You must pass an initialized class, but '$args{for}' has no metaclass"); + } + if ( Mouse::Util::is_a_metarole($for) ) { return _make_new_metaclass( $for, $args{role_metaroles}, 'role' ); }