Commit | Line | Data |
---|---|---|
f7fd22b6 | 1 | package Moose::Meta::Method::Accessor::Native::Array::push; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
8b9641b8 | 6 | use Moose::Role; |
7 | ||
7f5ec80d | 8 | with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => { |
9 | -excludes => [ | |
10 | qw( | |
a486d5ad | 11 | _inline_optimized_set_new_value |
7f5ec80d | 12 | _return_value |
13 | ) | |
14 | ] | |
15 | }; | |
f7fd22b6 | 16 | |
a7821be5 | 17 | sub _adds_members { 1 } |
f7fd22b6 | 18 | |
a7821be5 | 19 | sub _potential_value { |
53a4677c | 20 | my $self = shift; |
21 | my ($slot_access) = @_; | |
f7fd22b6 | 22 | |
53a4677c | 23 | return '[ @{ (' . $slot_access . ') }, @_ ]'; |
e32b7489 | 24 | } |
25 | ||
a486d5ad | 26 | sub _inline_optimized_set_new_value { |
53a4677c | 27 | my $self = shift; |
28 | my ($inv, $new, $slot_access) = @_; | |
e32b7489 | 29 | |
a486d5ad | 30 | return 'push @{ (' . $slot_access . ') }, @_;'; |
f7fd22b6 | 31 | } |
32 | ||
7f5ec80d | 33 | sub _return_value { |
53a4677c | 34 | my $self = shift; |
35 | my ($slot_access) = @_; | |
7f5ec80d | 36 | |
53a4677c | 37 | return 'scalar @{ (' . $slot_access . ') }'; |
7f5ec80d | 38 | } |
39 | ||
8b9641b8 | 40 | no Moose::Role; |
41 | ||
f7fd22b6 | 42 | 1; |