X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FMethod%2FAccessor%2FNative%2FArray%2Ffirst.pm;h=d996f6c38b0e7b4e31539f62209f7e88c8c41069;hb=e3181911a75bfb896df9ec013142348b1646acdf;hp=91c33695df57ad327deca90faba11396c4e0eaff;hpb=f5f08b5fc95e602afbd05df3d6e852541ee0ffd1;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/first.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/first.pm index 91c3369..d996f6c 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/first.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/first.pm @@ -11,15 +11,23 @@ our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Method::Accessor::Native::Array::Reader'; -sub _inline_process_arguments { - return 'my $func = shift;'; +sub _minimum_arguments { 1 } + +sub _maximum_arguments { 1 } + +sub _inline_check_arguments { + my $self = shift; + + return $self->_inline_throw_error( + q{'The argument passed to first must be a code reference'}) + . q{if $_[0] && ( ref $_[0] || q{} ) ne 'CODE';}; } sub _return_value { my $self = shift; my $slot_access = shift; - return "&List::Util::first( \$func, \@{ ${slot_access} } )"; + return "&List::Util::first( \$_[0], \@{ ${slot_access} } )"; } 1;