has 'thing' => (
...
- handles => { set_foo => [ set => [ 'foo' ] ] },
+ handles => { set_foo => [ set => 'foo' ] },
);
# $self->set_foo(...) calls $self->thing->set('foo', ...)
The first element of the array reference is the original method name, and the
-second is an array reference of curried arguments.
+rest is a list of curried arguments.
=item C<REGEXP>
$method_body = $method_to_call
if 'CODE' eq ref($method_to_call);
- my $curried_arguments = [];
+ my @curried_arguments;
- ($method_to_call, $curried_arguments) = @$method_to_call
+ ($method_to_call, @curried_arguments) = @$method_to_call
if 'ARRAY' eq ref($method_to_call);
return $self->delegation_metaclass->new(
package_name => $self->associated_class->name,
attribute => $self,
delegate_to_method => $method_to_call,
- curried_arguments => $curried_arguments || [],
+ curried_arguments => \@curried_arguments,
);
}
my $next = shift;
my ( $self, $handle_name, $method_to_call ) = @_;
- my ( $name, $curried_args ) = @$method_to_call;
-
- $curried_args ||= [];
+ my ( $name, @curried_args ) = @$method_to_call;
my $method_constructors = $self->method_constructors;
$handle_name,
sub {
my $instance = shift;
- return $code->( $instance, @$curried_args, @_ );
+ return $code->( $instance, @curried_args, @_ );
},
);
};
handles => {
'foo_bar' => 'bar',
foo_baz => 'baz',
- 'foo_bar_to_20' => [ bar => [ 20 ] ],
+ 'foo_bar_to_20' => [ bar => 20 ],
},
);
}
'sort_options_in_place' => 'sort_in_place',
'option_accessor' => 'accessor',
'add_options_with_speed' =>
- [ 'push' => [ 'funrolls', 'funbuns' ] ],
+ [ 'push' => 'funrolls', 'funbuns' ],
'prepend_prerequisites_along_with' =>
- [ 'unshift' => [ 'first', 'second' ] ],
+ [ 'unshift' => 'first', 'second' ],
'descending_options' =>
- [ 'sort_in_place' => [ $sort = sub { $_[1] <=> $_[0] } ] ],
+ [ 'sort_in_place' => ($sort = sub { $_[1] <=> $_[0] }) ],
}
);
}
'splice_options' => 'splice',
'sort_options_in_place' => 'sort_in_place',
'option_accessor' => 'accessor',
- 'add_options_with_speed' =>
- [ 'push' => [ 'funrolls', 'funbuns' ] ],
+ 'add_options_with_speed' => [ 'push' => 'funrolls', 'funbuns' ],
'prepend_prerequisites_along_with' =>
- [ 'unshift' => [ 'first', 'second' ] ],
- 'descending_options' =>
- [ 'sort_in_place' => [$sort] ],
+ [ 'unshift' => 'first', 'second' ],
+ 'descending_options' => [ 'sort_in_place' => $sort ],
},
'... got the right handles mapping'
);
'option_accessor' => 'accessor',
'key_value' => 'kv',
'options_elements' => 'elements',
- 'quantity' => [ accessor => ['quantity'] ],
+ 'quantity' => [ accessor => 'quantity' ],
},
);
}
'option_accessor' => 'accessor',
'key_value' => 'kv',
'options_elements' => 'elements',
- 'quantity' => [ accessor => ['quantity'] ],
+ 'quantity' => [ accessor => 'quantity' ],
},
'... got the right handles mapping'
);
div => 'div',
mod => 'mod',
abs => 'abs',
- inc => [ add => [1] ],
- dec => [ sub => [1] ],
- odd => [ mod => [2] ],
- cut_in_half => [ div => [2] ],
+ inc => [ add => 1 ],
+ dec => [ sub => 1 ],
+ odd => [ mod => 2 ],
+ cut_in_half => [ div => 2 ],
},
);
div => 'div',
mod => 'mod',
abs => 'abs',
- inc => [ add => [1] ],
- dec => [ sub => [1] ],
- odd => [ mod => [2] ],
- cut_in_half => [ div => [2] ],
+ inc => [ add => 1 ],
+ dec => [ sub => 1 ],
+ odd => [ mod => 2 ],
+ cut_in_half => [ div => 2 ],
},
'... got the right handles mapping'
);
'join_options' => 'join',
'get_option_at' => 'get',
'sorted_options' => 'sort',
- 'less_than_five' => [ grep => [ $less = sub { $_ < 5 } ] ],
- 'up_by_one' => [ map => [ $up = sub { $_ + 1 } ] ],
- 'dashify' => [ join => ['-'] ],
- 'descending' => [ sort => [ $sort = sub { $_[1] <=> $_[0] } ] ],
+ 'less_than_five' => [ grep => ($less = sub { $_ < 5 }) ],
+ 'up_by_one' => [ map => ($up = sub { $_ + 1 }) ],
+ 'dashify' => [ join => '-' ],
+ 'descending' => [ sort => ($sort = sub { $_[1] <=> $_[0] }) ],
},
);
'join_options' => 'join',
'get_option_at' => 'get',
'sorted_options' => 'sort',
- 'less_than_five' => [ grep => [$less] ],
- 'up_by_one' => [ map => [$up] ],
- 'dashify' => [ join => ['-'] ],
- 'descending' => [ sort => [$sort] ],
+ 'less_than_five' => [ grep => $less ],
+ 'up_by_one' => [ map => $up ],
+ 'dashify' => [ join => '-' ],
+ 'descending' => [ sort => $sort ],
},
'... got the right handles mapping'
);
chomp_string => 'chomp',
clear_string => 'clear',
length_string => 'length',
- exclaim => [ append => ['!'] ],
- capitalize_last =>
- [ replace => [ qr/(.)$/, $uc = sub { uc $1 } ] ],
- invalid_number => [ match => [qr/\D/] ],
+ exclaim => [ append => '!' ],
+ capitalize_last => [ replace => qr/(.)$/, ($uc = sub { uc $1 }) ],
+ invalid_number => [ match => qr/\D/ ],
},
);
}
chomp_string => 'chomp',
clear_string => 'clear',
length_string => 'length',
- exclaim => [ append => ['!'] ],
- capitalize_last => [ replace => [ qr/(.)$/, $uc ] ],
- invalid_number => [ match => [qr/\D/] ],
+ exclaim => [ append => '!' ],
+ capitalize_last => [ replace => qr/(.)$/, $uc ],
+ invalid_number => [ match => qr/\D/ ],
},
'... got the right handles methods'
);