bump version to 1.17
[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
bb09ad91 6our $VERSION = '1.17';
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 _maximum_arguments
16 _inline_capture_return_value
17 _inline_optimized_set_new_value
18 _return_value
19 )
20 ]
21};
a7821be5 22
23sub _maximum_arguments { 0 }
24
25sub _adds_members { 0 }
26
27sub _potential_value {
28 my ( $self, $slot_access ) = @_;
29
1d06edbf 30 return "[ \@{ ($slot_access) } > 1 ? \@{ ($slot_access) }[ 1 .. \$#{ ($slot_access) } ] : () ]";
a7821be5 31}
32
e32b7489 33sub _inline_capture_return_value {
a7821be5 34 my ( $self, $slot_access ) = @_;
35
e32b7489 36 return "my \$old = ${slot_access}->[0];";
37}
38
39sub _inline_optimized_set_new_value {
40 my ( $self, $inv, $new, $slot_access ) = @_;
41
1d06edbf 42 return "shift \@{ ($slot_access) };";
a7821be5 43}
44
45sub _return_value {
e32b7489 46 my ( $self, $slot_access ) = @_;
a7821be5 47
e32b7489 48 return 'return $old';
a7821be5 49}
50
8b9641b8 51no Moose::Role;
52
a7821be5 531;