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