Bump version to 1.9900 for new version numbering scheme
[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 ();
88e88a7b 7use Params::Util ();
f5f08b5f 8
bb8ef151 9our $VERSION = '1.9900';
f7fd22b6 10$VERSION = eval $VERSION;
11our $AUTHORITY = 'cpan:STEVAN';
12
8b9641b8 13use Moose::Role;
14
15with 'Moose::Meta::Method::Accessor::Native::Reader' => {
16 -excludes => [
17 qw(
18 _minimum_arguments
19 _maximum_arguments
20 _inline_check_arguments
21 )
22 ]
23};
f7fd22b6 24
a7821be5 25sub _minimum_arguments { 1 }
26
27sub _maximum_arguments { 1 }
f5f08b5f 28
910684ee 29sub _inline_check_arguments {
e3181911 30 my $self = shift;
31
53a4677c 32 return (
33 'if (!Params::Util::_CODELIKE($_[0])) {',
34 $self->_inline_throw_error(
35 '"The argument passed to first must be a code reference"',
36 ) . ';',
37 '}',
38 );
910684ee 39}
40
f7fd22b6 41sub _return_value {
53a4677c 42 my $self = shift;
43 my ($slot_access) = @_;
f7fd22b6 44
1e2c801e 45 return '&List::Util::first($_[0], @{ (' . $slot_access . ') })';
f7fd22b6 46}
47
8b9641b8 48no Moose::Role;
49
f7fd22b6 501;