X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FAttribute.pm;h=3e4bf749fc88f1a5fc6795b3f689883bfe831fdb;hb=9fa3924018dc60275270bca32a5f1357d61167e0;hp=564adbde27f04c7c51b239f788f36b041ac18a87;hpb=18748ad69a205a0ae4acea224d69f10f3db53834;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 564adbd..3e4bf74 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -7,7 +7,7 @@ use warnings; use Scalar::Util 'blessed', 'weaken'; use overload (); -our $VERSION = '0.57'; +our $VERSION = '0.60'; our $AUTHORITY = 'cpan:STEVAN'; use Moose::Meta::Method::Accessor; @@ -61,7 +61,7 @@ sub does { Moose::Util::resolve_metatrait_alias(Attribute => $role_name) }; return 0 if !defined($name); # failed to load class - return Moose::Object::does($self, $name); + return $self->Moose::Object::does($name); } sub throw_error { @@ -523,7 +523,7 @@ sub get_value { $value = $type_constraint->coerce($value) if ($self->should_coerce); $type_constraint->check($value) - || c$self->throw_error("Attribute (" . $self->name + || $self->throw_error("Attribute (" . $self->name . ") does not pass the type constraint because: " . $type_constraint->get_message($value), type_constraint => $type_constraint, data => $value); } @@ -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