X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FMethod%2FAccessor%2FNative%2FHash%2Fdelete.pm;h=e471a0aaa8027a8c70b74def75aa5405624a71d1;hb=00bbc132f9e1cb2b1a44aa287887cafa27a84577;hp=e7cf85de34f4995a2999293e3327b575ece012ed;hpb=1d06edbfadf08687599bd8c8fd711f8c14cc2363;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Method/Accessor/Native/Hash/delete.pm b/lib/Moose/Meta/Method/Accessor/Native/Hash/delete.pm index e7cf85d..e471a0a 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Hash/delete.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Hash/delete.pm @@ -3,39 +3,35 @@ package Moose::Meta::Method::Accessor::Native::Hash::delete; use strict; use warnings; -our $VERSION = '1.16'; -$VERSION = eval $VERSION; -our $AUTHORITY = 'cpan:STEVAN'; - use Moose::Role; -with 'Moose::Meta::Method::Accessor::Native::Hash::Writer' => { - -excludes => [ - qw( - _inline_optimized_set_new_value - _return_value - ) - ], -}; +with 'Moose::Meta::Method::Accessor::Native::Hash::Writer'; sub _adds_members { 0 } sub _potential_value { - my ( $self, $slot_access ) = @_; - - return "( do { my \%potential = %{ ($slot_access) }; \@return = delete \@potential{\@_}; \\\%potential; } )"; + my $self = shift; + my ($slot_access) = @_; + + return '(do { ' + . 'my %potential = %{ (' . $slot_access . ') }; ' + . '@return = delete @potential{@_}; ' + . '\%potential; ' + . '})'; } sub _inline_optimized_set_new_value { - my ( $self, $inv, $new, $slot_access ) = @_; + my $self = shift; + my ($inv, $new, $slot_access) = @_; - return "\@return = delete \@{ ($slot_access) }{\@_}"; + return '@return = delete @{ (' . $slot_access . ') }{@_};'; } sub _return_value { - my ( $self, $slot_access ) = @_; + my $self = shift; + my ($slot_access) = @_; - return 'return wantarray ? @return : $return[-1];'; + return 'wantarray ? @return : $return[-1]'; } no Moose::Role;