Tidy delegation routine
gfx [Mon, 22 Feb 2010 07:45:00 +0000 (16:45 +0900)]
lib/Mouse/Meta/Attribute.pm
lib/Mouse/Meta/Method/Delegation.pm

index cc43a37..b4511d0 100644 (file)
@@ -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{
index 60bdad8..413f6da 100644 (file)
@@ -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();