X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FAttribute.pm;h=a37601d6f4c65a4fce2d045e1f4c454cb36165c1;hb=26f0aa174f72fdf5fd803278212b7cefa83c8734;hp=4ef21dbc98da7eba0c63fd40911a5d7f8b04267f;hpb=e8ad67f0a28dcb7eb4550009e6ef579975ebafec;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 4ef21db..a37601d 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -34,6 +34,7 @@ my %valid_options = map { $_ => undef } ( # internally used 'associated_class', 'associated_methods', + '__METACLASS__', # Moose defines, but Mouse doesn't #'definition_context', @@ -262,8 +263,9 @@ sub install_accessors{ # install delegation if(exists $attribute->{handles}){ my %handles = $attribute->_canonicalize_handles(); - while(my($handle, $method_to_call) = each %handles){ + next if Mouse::Object->can($handle); + if($metaclass->has_method($handle)) { $attribute->throw_error("You cannot overwrite a locally defined method ($handle) with a delegation"); } @@ -297,7 +299,7 @@ sub _canonicalize_handles { elsif ($handle_type eq 'Regexp') { my $meta = $self->_find_delegate_metaclass(); return map { $_ => $_ } - grep { !Mouse::Object->can($_) && $_ =~ $handles } + grep { /$handles/ } Mouse::Util::is_a_metarole($meta) ? $meta->get_method_list : $meta->get_all_method_names; @@ -340,7 +342,7 @@ Mouse::Meta::Attribute - The Mouse attribute metaclass =head1 VERSION -This document describes Mouse version 0.73 +This document describes Mouse version 0.77 =head1 DESCRIPTION