From: gfx Date: Mon, 22 Feb 2010 07:45:00 +0000 (+0900) Subject: Tidy delegation routine X-Git-Tag: 0.50_03~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=21ee5bbbc20a3366955be77a589206295b5c0f9e;p=gitmo%2FMouse.git Tidy delegation routine --- diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index cc43a37..b4511d0 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -375,10 +375,7 @@ sub _make_delegation_method { my $delegator = $self->delegation_metaclass; Mouse::Util::load_class($delegator); - return $delegator->_generate_delegation($self, $handle, - ref($method_to_call) eq 'ARRAY' - ? @{$method_to_call} - : $method_to_call); + return $delegator->_generate_delegation($self, $handle, $method_to_call); } sub throw_error{ diff --git a/lib/Mouse/Meta/Method/Delegation.pm b/lib/Mouse/Meta/Method/Delegation.pm index 60bdad8..413f6da 100644 --- a/lib/Mouse/Meta/Method/Delegation.pm +++ b/lib/Mouse/Meta/Method/Delegation.pm @@ -3,7 +3,12 @@ use Mouse::Util qw(:meta); # enables strict and warnings use Scalar::Util; sub _generate_delegation{ - my (undef, $attr, $handle_name, $method_to_call, @curried_args) = @_; + my (undef, $attr, $handle_name, $method_to_call) = @_; + + my @curried_args; + if(ref($method_to_call) eq 'ARRAY'){ + ($method_to_call, @curried_args) = @{$method_to_call}; + } my $reader = $attr->get_read_method_ref();