use new method names from cmop
[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
245478d5 6our $VERSION = '1.19';
a7821be5 7$VERSION = eval $VERSION;
8our $AUTHORITY = 'cpan:STEVAN';
9
8b9641b8 10use Moose::Role;
11
12with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => {
13 -excludes => [
14 qw(
15 _minimum_arguments
16 _maximum_arguments
17 _inline_check_arguments
a486d5ad 18 _inline_optimized_set_new_value
7f5ec80d 19 _return_value
8b9641b8 20 )
21 ],
22};
a7821be5 23
24sub _minimum_arguments { 1 }
25
26sub _maximum_arguments { 1 }
27
28sub _inline_check_arguments {
29 my $self = shift;
30
31 return $self->_inline_check_var_is_valid_index('$_[0]');
32}
33
34sub _adds_members { 0 }
35
36sub _potential_value {
53a4677c 37 my $self = shift;
38 my ($slot_access) = @_;
a7821be5 39
53a4677c 40 return '(do { '
41 . 'my @potential = @{ (' . $slot_access . ') }; '
42 . '@return = splice @potential, $_[0], 1; '
43 . '\@potential; '
44 . '})';
e32b7489 45}
46
a486d5ad 47sub _inline_optimized_set_new_value {
53a4677c 48 my $self = shift;
49 my ($inv, $new, $slot_access) = @_;
e32b7489 50
a486d5ad 51 return '@return = splice @{ (' . $slot_access . ') }, $_[0], 1;';
7f5ec80d 52}
53
54sub _return_value {
53a4677c 55 my $self = shift;
56 my ($slot_access) = @_;
7f5ec80d 57
53a4677c 58 return '$return[0]';
a7821be5 59}
60
8b9641b8 61no Moose::Role;
62
a7821be5 631;