stop using excludes within moose, since it's no longer necessary
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array / shift.pm
CommitLineData
a7821be5 1package Moose::Meta::Method::Accessor::Native::Array::shift;
2
3use strict;
4use warnings;
5
8b9641b8 6use Moose::Role;
7
00bbc132 8with 'Moose::Meta::Method::Accessor::Native::Array::Writer';
a7821be5 9
10sub _maximum_arguments { 0 }
11
12sub _adds_members { 0 }
13
14sub _potential_value {
53a4677c 15 my $self = shift;
16 my ($slot_access) = @_;
a7821be5 17
53a4677c 18 return '[ @{ (' . $slot_access . ') } > 1 '
19 . '? @{ (' . $slot_access . ') }[1..$#{ (' . $slot_access . ') }] '
20 . ': () ]';
a7821be5 21}
22
e32b7489 23sub _inline_capture_return_value {
53a4677c 24 my $self = shift;
25 my ($slot_access) = @_;
a7821be5 26
53a4677c 27 return 'my $old = ' . $slot_access . '->[0];';
e32b7489 28}
29
a486d5ad 30sub _inline_optimized_set_new_value {
53a4677c 31 my $self = shift;
32 my ($inv, $new, $slot_access) = @_;
e32b7489 33
a486d5ad 34 return 'shift @{ (' . $slot_access . ') };';
a7821be5 35}
36
37sub _return_value {
53a4677c 38 my $self = shift;
39 my ($slot_access) = @_;
a7821be5 40
53a4677c 41 return '$old';
a7821be5 42}
43
8b9641b8 44no Moose::Role;
45
a7821be5 461;