From: Dave Rolsky Date: Tue, 26 Oct 2010 21:51:24 +0000 (-0500) Subject: Tidy code and add whitespace in _process_accessors X-Git-Tag: 1.18~44 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=837f61c90dc82b2bcf32dce9aeb57a7381437d48;p=gitmo%2FMoose.git Tidy code and add whitespace in _process_accessors --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 08c22f8..5d3f5d5 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -565,23 +565,29 @@ sub _check_associated_methods { sub _process_accessors { my $self = shift; my ($type, $accessor, $generate_as_inline_methods) = @_; - $accessor = (keys %$accessor)[0] if (ref($accessor)||'') eq 'HASH'; + + $accessor = ( keys %$accessor )[0] if ( ref($accessor) || '' ) eq 'HASH'; my $method = $self->associated_class->get_method($accessor); - if ($method && !$method->isa('Class::MOP::Method::Accessor') - && (!$self->definition_context - || $method->package_name eq $self->definition_context->{package})) { + + if ( + $method + && !$method->isa('Class::MOP::Method::Accessor') + && ( !$self->definition_context + || $method->package_name eq $self->definition_context->{package} ) + ) { + Carp::cluck( "You are overwriting a locally defined method ($accessor) with " - . "an accessor" - ); + . "an accessor" ); } - if (!$self->associated_class->has_method($accessor) - && $self->associated_class->has_package_symbol('&' . $accessor)) { + if ( !$self->associated_class->has_method($accessor) + && $self->associated_class->has_package_symbol( '&' . $accessor ) ) { + Carp::cluck( "You are overwriting a locally defined function ($accessor) with " - . "an accessor" - ); + . "an accessor" ); } + $self->SUPER::_process_accessors(@_); }