bump version to 1.18
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array / pop.pm
1 package Moose::Meta::Method::Accessor::Native::Array::pop;
2
3 use strict;
4 use warnings;
5
6 our $VERSION = '1.18';
7 $VERSION = eval $VERSION;
8 our $AUTHORITY = 'cpan:STEVAN';
9
10 use Moose::Role;
11
12 with '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 };
20
21 sub _maximum_arguments { 0 }
22
23 sub _adds_members { 0 }
24
25 sub _potential_value {
26     my ( $self, $slot_access ) = @_;
27
28     return "[ \@{ ($slot_access) } > 1 ? \@{ ($slot_access) }[ 0 .. \$#{ ($slot_access) } - 1 ] : () ]";
29 }
30
31 sub _inline_capture_return_value {
32     my ( $self, $slot_access ) = @_;
33
34     return "my \$old = ${slot_access}->[-1];";
35 }
36
37 sub _inline_optimized_set_new_value {
38     my ( $self, $inv, $new, $slot_access ) = @_;
39
40     return "pop \@{ ($slot_access) }";
41 }
42
43 sub _return_value {
44     my ( $self, $slot_access ) = @_;
45
46     return 'return $old;';
47 }
48
49 no Moose::Role;
50
51 1;