From: Shawn M Moore Date: Sat, 28 Mar 2009 20:20:10 +0000 (-0400) Subject: We throw fine error messages when trying to get a role metaclass X-Git-Tag: 0.73_01~36^2~33 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=425ca6051520e01114d9ce1374656c26ce799e49;p=gitmo%2FMoose.git We throw fine error messages when trying to get a role metaclass --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 73b6047..96dc22b 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -623,13 +623,10 @@ sub _canonicalize_handles { Class::MOP::load_class($handles) unless Class::MOP::is_class_loaded($handles); - my $role_meta = eval { $handles->meta }; - if ($@) { - $self->throw_error("Unable to canonicalize the 'handles' option with $handles because : $@", data => $handles, error => $@); - } + my $role_meta = Class::MOP::class_of($handles); (blessed $role_meta && $role_meta->isa('Moose::Meta::Role')) - || $self->throw_error("Unable to canonicalize the 'handles' option with $handles because ->meta is not a Moose::Meta::Role", data => $handles); + || $self->throw_error("Unable to canonicalize the 'handles' option with $handles because its metaclass is not a Moose::Meta::Role", data => $handles); return map { $_ => $_ } ( $role_meta->get_method_list,