1package Moose::Meta::Method::Accessor::Native::Array::sort_in_place;
2our $VERSION = '2.2201';
3
4use strict;
5use warnings;
6
7use Params::Util ();
8
9use Moose::Role;
10
11with 'Moose::Meta::Method::Accessor::Native::Array::Writer';
12
13sub _maximum_arguments { 1 }
14
15sub _inline_check_arguments {
16    my $self = shift;
17
18    return (
19        'if (@_ && !Params::Util::_CODELIKE($_[0])) {',
20            $self->_inline_throw_exception( InvalidArgumentToMethod =>
21                                            'argument                => $_[0],'.
22                                            'method_name             => "sort_in_place",'.
23                                            'type_of_argument        => "code reference",'.
24                                            'type                    => "CodeRef",',
25            ) . ';',
26        '}',
27    );
28}
29
30sub _adds_members { 0 }
31
32sub _potential_value {
33    my $self = shift;
34    my ($slot_access) = @_;
35
36    return '[ $_[0] '
37             . '? sort { $_[0]->($a, $b) } @{ (' . $slot_access . ') } '
38             . ': sort @{ (' . $slot_access . ') } ]';
39}
40
41sub _return_value { '' }
42
43no Moose::Role;
44
451;
46