Commit | Line | Data |
f7fd22b6 |
1 | package Moose::Meta::Method::Accessor::Native::Array::first; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
f5f08b5f |
6 | use List::Util (); |
7 | |
f7fd22b6 |
8 | our $VERSION = '1.13'; |
9 | $VERSION = eval $VERSION; |
10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | |
126a13c8 |
12 | use base 'Moose::Meta::Method::Accessor::Native::Reader'; |
f7fd22b6 |
13 | |
a7821be5 |
14 | sub _minimum_arguments { 1 } |
15 | |
16 | sub _maximum_arguments { 1 } |
f5f08b5f |
17 | |
910684ee |
18 | sub _inline_check_arguments { |
e3181911 |
19 | my $self = shift; |
20 | |
21 | return $self->_inline_throw_error( |
22 | q{'The argument passed to first must be a code reference'}) |
23 | . q{if $_[0] && ( ref $_[0] || q{} ) ne 'CODE';}; |
910684ee |
24 | } |
25 | |
f7fd22b6 |
26 | sub _return_value { |
27 | my $self = shift; |
28 | my $slot_access = shift; |
29 | |
a7821be5 |
30 | return "&List::Util::first( \$_[0], \@{ ${slot_access} } )"; |
f7fd22b6 |
31 | } |
32 | |
33 | 1; |