Use dzil Authority plugin - remove $AUTHORITY from code
[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
8with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => {
9 -excludes => [
10 qw(
11 _maximum_arguments
12 _inline_capture_return_value
a486d5ad 13 _inline_optimized_set_new_value
8b9641b8 14 _return_value
15 )
16 ]
17};
a7821be5 18
19sub _maximum_arguments { 0 }
20
21sub _adds_members { 0 }
22
23sub _potential_value {
53a4677c 24 my $self = shift;
25 my ($slot_access) = @_;
a7821be5 26
53a4677c 27 return '[ @{ (' . $slot_access . ') } > 1 '
28 . '? @{ (' . $slot_access . ') }[1..$#{ (' . $slot_access . ') }] '
29 . ': () ]';
a7821be5 30}
31
e32b7489 32sub _inline_capture_return_value {
53a4677c 33 my $self = shift;
34 my ($slot_access) = @_;
a7821be5 35
53a4677c 36 return 'my $old = ' . $slot_access . '->[0];';
e32b7489 37}
38
a486d5ad 39sub _inline_optimized_set_new_value {
53a4677c 40 my $self = shift;
41 my ($inv, $new, $slot_access) = @_;
e32b7489 42
a486d5ad 43 return 'shift @{ (' . $slot_access . ') };';
a7821be5 44}
45
46sub _return_value {
53a4677c 47 my $self = shift;
48 my ($slot_access) = @_;
a7821be5 49
53a4677c 50 return '$old';
a7821be5 51}
52
8b9641b8 53no Moose::Role;
54
a7821be5 551;