From: Chris Prather Date: Mon, 27 Oct 2008 02:10:31 +0000 (+0000) Subject: load_class for a Role if the Role isn't already loaded during handles X-Git-Tag: 0.61~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9fa3924018dc60275270bca32a5f1357d61167e0;p=gitmo%2FMoose.git load_class for a Role if the Role isn't already loaded during handles --- diff --git a/Changes b/Changes index f8b7efd..a22dccc 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,8 @@ Revision history for Perl extension Moose +0.61 ??? + * Moose::Meta::Attribue + - load_class for a Role if the Role isn't already loaded during handles + (perigrin) 0.60 Fri October 24, 2008 * Moose::Exporter diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 9a7fdc9..3e4bf74 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -630,6 +630,9 @@ sub _canonicalize_handles { } } else { + 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 => $@); @@ -637,7 +640,7 @@ sub _canonicalize_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); - + return map { $_ => $_ } ( $role_meta->get_method_list, $role_meta->get_required_method_list