Commit | Line | Data |
a7821be5 |
1 | package Moose::Meta::Method::Accessor::Native::Array::sort_in_place; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
88e88a7b |
6 | use Params::Util (); |
7 | |
d874ffad |
8 | our $VERSION = '1.20'; |
a7821be5 |
9 | $VERSION = eval $VERSION; |
10 | our $AUTHORITY = 'cpan:STEVAN'; |
11 | |
8b9641b8 |
12 | use Moose::Role; |
13 | |
14 | with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => { |
15 | -excludes => [ |
16 | qw( |
17 | _maximum_arguments |
18 | _inline_check_arguments |
7f5ec80d |
19 | _return_value |
8b9641b8 |
20 | ) |
21 | ] |
22 | }; |
a7821be5 |
23 | |
24 | sub _maximum_arguments { 1 } |
25 | |
26 | sub _inline_check_arguments { |
e3181911 |
27 | my $self = shift; |
28 | |
29 | return $self->_inline_throw_error( |
30 | q{'The argument passed to sort_in_place must be a code reference'}) |
88e88a7b |
31 | . q{ if @_ && ! Params::Util::_CODELIKE( $_[0] );}; |
a7821be5 |
32 | } |
33 | |
34 | sub _adds_members { 0 } |
35 | |
36 | sub _potential_value { |
37 | my ( $self, $slot_access ) = @_; |
38 | |
39 | return |
1d06edbf |
40 | "[ \$_[0] ? sort { \$_[0]->( \$a, \$b ) } \@{ ($slot_access) } : sort \@{ ($slot_access) } ]"; |
a7821be5 |
41 | } |
42 | |
7f5ec80d |
43 | sub _return_value { return q{} } |
44 | |
8b9641b8 |
45 | no Moose::Role; |
46 | |
a7821be5 |
47 | 1; |