bump version to 1.19
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array / pop.pm
CommitLineData
a7821be5 1package Moose::Meta::Method::Accessor::Native::Array::pop;
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( _maximum_arguments
15 _inline_capture_return_value
16 _inline_optimized_set_new_value
17 _return_value )
18 ]
19};
a7821be5 20
21sub _maximum_arguments { 0 }
22
23sub _adds_members { 0 }
24
25sub _potential_value {
26 my ( $self, $slot_access ) = @_;
27
1d06edbf 28 return "[ \@{ ($slot_access) } > 1 ? \@{ ($slot_access) }[ 0 .. \$#{ ($slot_access) } - 1 ] : () ]";
a7821be5 29}
30
e32b7489 31sub _inline_capture_return_value {
a7821be5 32 my ( $self, $slot_access ) = @_;
33
e32b7489 34 return "my \$old = ${slot_access}->[-1];";
35}
36
37sub _inline_optimized_set_new_value {
38 my ( $self, $inv, $new, $slot_access ) = @_;
39
1d06edbf 40 return "pop \@{ ($slot_access) }";
a7821be5 41}
42
43sub _return_value {
e32b7489 44 my ( $self, $slot_access ) = @_;
a7821be5 45
e32b7489 46 return 'return $old;';
a7821be5 47}
48
8b9641b8 49no Moose::Role;
50
a7821be5 511;