All native array methods are being inlined.
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array / first.pm
CommitLineData
f7fd22b6 1package Moose::Meta::Method::Accessor::Native::Array::first;
2
3use strict;
4use warnings;
5
f5f08b5f 6use List::Util ();
7
f7fd22b6 8our $VERSION = '1.13';
9$VERSION = eval $VERSION;
10our $AUTHORITY = 'cpan:STEVAN';
11
12use base 'Moose::Meta::Method::Accessor::Native::Array::Reader';
13
a7821be5 14sub _minimum_arguments { 1 }
15
16sub _maximum_arguments { 1 }
f5f08b5f 17
910684ee 18sub _inline_check_arguments {
19 return
a7821be5 20 q{die 'Must provide a code reference as an argument' unless ( ref $_[0] || q{} ) eq 'CODE';};
910684ee 21}
22
f7fd22b6 23sub _return_value {
24 my $self = shift;
25 my $slot_access = shift;
26
a7821be5 27 return "&List::Util::first( \$_[0], \@{ ${slot_access} } )";
f7fd22b6 28}
29
301;