stop using excludes within moose, since it's no longer necessary
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array / first_index.pm
CommitLineData
175f9180 1package Moose::Meta::Method::Accessor::Native::Array::first_index;
2
3use strict;
4use warnings;
5
6use List::MoreUtils ();
7use Params::Util ();
8
9use Moose::Role;
10
00bbc132 11with 'Moose::Meta::Method::Accessor::Native::Reader';
175f9180 12
13sub _minimum_arguments { 1 }
14
15sub _maximum_arguments { 1 }
16
17sub _inline_check_arguments {
18 my $self = shift;
19
20 return (
21 'if (!Params::Util::_CODELIKE($_[0])) {',
22 $self->_inline_throw_error(
23 '"The argument passed to first_index must be a code reference"',
24 ) . ';',
25 '}',
26 );
27}
28
29sub _return_value {
30 my $self = shift;
31 my ($slot_access) = @_;
32
33 return '&List::MoreUtils::first_index($_[0], @{ (' . $slot_access . ') })';
34}
35
36no Moose::Role;
37
381;