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