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=0a86add2e1af84b4060587d762eeb6b7087a6c99;hb=d5f6cadef8d83deaf7dd95302908cd4f61aeab8a;hp=d9a9990823204c93d8a8ffeb166e35bf187f96cc;hpb=1d06edbfadf08687599bd8c8fd711f8c14cc2363;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 d9a9990..0a86add 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/first.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/first.pm @@ -6,10 +6,6 @@ use warnings; use List::Util (); use Params::Util (); -our $VERSION = '1.16'; -$VERSION = eval $VERSION; -our $AUTHORITY = 'cpan:STEVAN'; - use Moose::Role; with 'Moose::Meta::Method::Accessor::Native::Reader' => { @@ -29,16 +25,20 @@ 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{ unless Params::Util::_CODELIKE( $_[0] );}; + return ( + 'if (!Params::Util::_CODELIKE($_[0])) {', + $self->_inline_throw_error( + '"The argument passed to first must be a code reference"', + ) . ';', + '}', + ); } sub _return_value { - my $self = shift; - my $slot_access = shift; + my $self = shift; + my ($slot_access) = @_; - return "&List::Util::first( \$_[0], \@{ ($slot_access) } )"; + return '&List::Util::first($_[0], @{ (' . $slot_access . ') })'; } no Moose::Role;