stop using excludes within moose, since it's no longer necessary
[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
00bbc132 8with 'Moose::Meta::Method::Accessor::Native::Array::Writer';
a7821be5 9
10sub _minimum_arguments { 1 }
11
12sub _maximum_arguments { 1 }
13
14sub _inline_check_arguments {
15 my $self = shift;
16
17 return $self->_inline_check_var_is_valid_index('$_[0]');
18}
19
20sub _adds_members { 0 }
21
22sub _potential_value {
53a4677c 23 my $self = shift;
24 my ($slot_access) = @_;
a7821be5 25
53a4677c 26 return '(do { '
27 . 'my @potential = @{ (' . $slot_access . ') }; '
28 . '@return = splice @potential, $_[0], 1; '
29 . '\@potential; '
30 . '})';
e32b7489 31}
32
a486d5ad 33sub _inline_optimized_set_new_value {
53a4677c 34 my $self = shift;
35 my ($inv, $new, $slot_access) = @_;
e32b7489 36
a486d5ad 37 return '@return = splice @{ (' . $slot_access . ') }, $_[0], 1;';
7f5ec80d 38}
39
40sub _return_value {
53a4677c 41 my $self = shift;
42 my ($slot_access) = @_;
7f5ec80d 43
53a4677c 44 return '$return[0]';
a7821be5 45}
46
8b9641b8 47no Moose::Role;
48
a7821be5 491;