Commit | Line | Data |
910684ee |
1 | package Moose::Meta::Method::Accessor::Native::Array::reduce; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use List::Util (); |
7 | |
8 | our $VERSION = '1.13'; |
9 | $VERSION = eval $VERSION; |
10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | |
12 | use base 'Moose::Meta::Method::Accessor::Native::Array::Reader'; |
13 | |
14 | sub _inline_process_arguments { |
15 | return 'my $func = shift;'; |
16 | } |
17 | |
18 | sub _inline_check_arguments { |
19 | return |
20 | q{die 'Must provide a code reference as an argument' unless ( ref $func || q{} ) eq 'CODE';}; |
21 | } |
22 | |
23 | sub _return_value { |
24 | my $self = shift; |
25 | my $slot_access = shift; |
26 | |
27 | return "List::Util::reduce { \$func->( \$a, \$b ) } \@{ ${slot_access} }"; |
28 | } |
29 | |
30 | 1; |