stop using excludes within moose, since it's no longer necessary
[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
00bbc132 10with 'Moose::Meta::Method::Accessor::Native::Reader';
f7fd22b6 11
a7821be5 12sub _minimum_arguments { 1 }
13
14sub _maximum_arguments { 1 }
f7fd22b6 15
910684ee 16sub _inline_check_arguments {
e3181911 17 my $self = shift;
18
53a4677c 19 return (
20 'if (!Params::Util::_CODELIKE($_[0])) {',
21 $self->_inline_throw_error(
22 '"The argument passed to map must be a code reference"',
23 ) . ';',
24 '}',
25 );
910684ee 26}
27
f7fd22b6 28sub _return_value {
53a4677c 29 my $self = shift;
30 my ($slot_access) = @_;
f7fd22b6 31
53a4677c 32 return 'map { $_[0]->() } @{ (' . $slot_access . ') }';
f7fd22b6 33}
34
8b9641b8 35no Moose::Role;
36
f7fd22b6 371;