Use dzil Authority plugin - remove $AUTHORITY from code
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array / delete.pm
CommitLineData
a7821be5 1package Moose::Meta::Method::Accessor::Native::Array::delete;
2
3use strict;
4use warnings;
5
8b9641b8 6use Moose::Role;
7
8with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => {
9 -excludes => [
10 qw(
11 _minimum_arguments
12 _maximum_arguments
13 _inline_check_arguments
a486d5ad 14 _inline_optimized_set_new_value
7f5ec80d 15 _return_value
8b9641b8 16 )
17 ],
18};
a7821be5 19
20sub _minimum_arguments { 1 }
21
22sub _maximum_arguments { 1 }
23
24sub _inline_check_arguments {
25 my $self = shift;
26
27 return $self->_inline_check_var_is_valid_index('$_[0]');
28}
29
30sub _adds_members { 0 }
31
32sub _potential_value {
53a4677c 33 my $self = shift;
34 my ($slot_access) = @_;
a7821be5 35
53a4677c 36 return '(do { '
37 . 'my @potential = @{ (' . $slot_access . ') }; '
38 . '@return = splice @potential, $_[0], 1; '
39 . '\@potential; '
40 . '})';
e32b7489 41}
42
a486d5ad 43sub _inline_optimized_set_new_value {
53a4677c 44 my $self = shift;
45 my ($inv, $new, $slot_access) = @_;
e32b7489 46
a486d5ad 47 return '@return = splice @{ (' . $slot_access . ') }, $_[0], 1;';
7f5ec80d 48}
49
50sub _return_value {
53a4677c 51 my $self = shift;
52 my ($slot_access) = @_;
7f5ec80d 53
53a4677c 54 return '$return[0]';
a7821be5 55}
56
8b9641b8 57no Moose::Role;
58
a7821be5 591;