X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FMethod%2FAccessor%2FNative%2FArray%2Funshift.pm;h=f545ae2f176aa411b34e2479e49e921e5ae63d6e;hb=a486d5ade76c569625615022b49d03c92d6e93c2;hp=27f6b5378ae2f9a636fdd88c1e7ed2a488460960;hpb=a7821be5fbdedff67afce753d73c580ae5ada592;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/unshift.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/unshift.pm index 27f6b53..f545ae2 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Array/unshift.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Array/unshift.pm @@ -3,18 +3,44 @@ package Moose::Meta::Method::Accessor::Native::Array::unshift; use strict; use warnings; -our $VERSION = '1.13'; +our $VERSION = '1.19'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; -use base 'Moose::Meta::Method::Accessor::Native::Array::Writer'; +use Moose::Role; + +with 'Moose::Meta::Method::Accessor::Native::Array::Writer' => { + -excludes => [ + qw( + _inline_optimized_set_new_value + _return_value + ) + ] +}; sub _adds_members { 1 } sub _potential_value { - my ( $self, $slot_access ) = @_; + my $self = shift; + my ($slot_access) = @_; + + return '[ @_, @{ (' . $slot_access . ') } ]'; +} + +sub _inline_optimized_set_new_value { + my $self = shift; + my ($inv, $new, $slot_access) = @_; - return "( \@_, \@{ $slot_access } )"; + return 'unshift @{ (' . $slot_access . ') }, @_;'; } +sub _return_value { + my $self = shift; + my ($slot_access) = @_; + + return 'scalar @{ (' . $slot_access . ') }'; +} + +no Moose::Role; + 1;