X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FAttribute.pm;h=49a9a451af95152dc05804465a8b6427cfbce19e;hb=115601b633616f33337b6188362da87b4bf06090;hp=59ec38580f83c68ae94d5cfb8a0773faea996844;hpb=9e4ed568f2e5c1041e6fea8d0cbde420562ab5df;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 59ec385..49a9a45 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.84'; +our $VERSION = '0.85'; our $AUTHORITY = 'cpan:STEVAN'; use Moose::Meta::Method::Accessor; @@ -40,6 +40,7 @@ __PACKAGE__->meta->add_attribute('trigger' => ( )); __PACKAGE__->meta->add_attribute('handles' => ( reader => 'handles', + writer => '_set_handles', predicate => 'has_handles', )); __PACKAGE__->meta->add_attribute('documentation' => ( @@ -557,17 +558,23 @@ sub install_accessors { my $self = shift; $self->SUPER::install_accessors(@_); $self->install_delegation if $self->has_handles; + return; +} + +sub _check_associated_methods { + my $self = shift; unless ( @{ $self->associated_methods } || ($self->_is_metadata || '') eq 'bare' ) { Carp::cluck( - 'Attribute (' . $self->name . ') has no associated methods' + 'Attribute (' . $self->name . ') of class ' + . $self->associated_class->name + . ' has no associated methods' . ' (did you mean to provide an "is" argument?)' . "\n" ) } - return; } sub _process_accessors { @@ -724,11 +731,17 @@ sub _make_delegation_method { $method_body = $method_to_call if 'CODE' eq ref($method_to_call); + my $curried_arguments = []; + + ($method_to_call, $curried_arguments) = @$method_to_call + if 'ARRAY' eq ref($method_to_call); + return $self->delegation_metaclass->new( name => $handle_name, package_name => $self->associated_class->name, attribute => $self, delegate_to_method => $method_to_call, + curried_arguments => $curried_arguments || [], ); }