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