Use dzil Authority plugin - remove $AUTHORITY from code
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array / map.pm
CommitLineData
f7fd22b6 1package Moose::Meta::Method::Accessor::Native::Array::map;
2
3use strict;
4use warnings;
5
88e88a7b 6use Params::Util ();
7
8b9641b8 8use Moose::Role;
9
10with 'Moose::Meta::Method::Accessor::Native::Reader' => {
11 -excludes => [
12 qw(
13 _minimum_arguments
14 _maximum_arguments
15 _inline_check_arguments
16 )
17 ]
18};
f7fd22b6 19
a7821be5 20sub _minimum_arguments { 1 }
21
22sub _maximum_arguments { 1 }
f7fd22b6 23
910684ee 24sub _inline_check_arguments {
e3181911 25 my $self = shift;
26
53a4677c 27 return (
28 'if (!Params::Util::_CODELIKE($_[0])) {',
29 $self->_inline_throw_error(
30 '"The argument passed to map must be a code reference"',
31 ) . ';',
32 '}',
33 );
910684ee 34}
35
f7fd22b6 36sub _return_value {
53a4677c 37 my $self = shift;
38 my ($slot_access) = @_;
f7fd22b6 39
53a4677c 40 return 'map { $_[0]->() } @{ (' . $slot_access . ') }';
f7fd22b6 41}
42
8b9641b8 43no Moose::Role;
44
f7fd22b6 451;