stop using excludes within moose, since it's no longer necessary
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array / sort_in_place.pm
CommitLineData
a7821be5 1package Moose::Meta::Method::Accessor::Native::Array::sort_in_place;
2
3use strict;
4use warnings;
5
88e88a7b 6use Params::Util ();
7
8b9641b8 8use Moose::Role;
9
00bbc132 10with 'Moose::Meta::Method::Accessor::Native::Array::Writer';
a7821be5 11
12sub _maximum_arguments { 1 }
13
14sub _inline_check_arguments {
e3181911 15 my $self = shift;
16
53a4677c 17 return (
18 'if (@_ && !Params::Util::_CODELIKE($_[0])) {',
19 $self->_inline_throw_error(
20 '"The argument passed to sort_in_place must be a code '
21 . 'reference"',
22 ) . ';',
23 '}',
24 );
a7821be5 25}
26
27sub _adds_members { 0 }
28
29sub _potential_value {
53a4677c 30 my $self = shift;
31 my ($slot_access) = @_;
a7821be5 32
53a4677c 33 return '[ $_[0] '
34 . '? sort { $_[0]->($a, $b) } @{ (' . $slot_access . ') } '
35 . ': sort @{ (' . $slot_access . ') } ]';
a7821be5 36}
37
1e2c801e 38sub _return_value { '' }
7f5ec80d 39
8b9641b8 40no Moose::Role;
41
a7821be5 421;