stop using excludes within moose, since it's no longer necessary
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Hash / delete.pm
CommitLineData
44babf1f 1package Moose::Meta::Method::Accessor::Native::Hash::delete;
2
3use strict;
4use warnings;
5
8b9641b8 6use Moose::Role;
7
00bbc132 8with 'Moose::Meta::Method::Accessor::Native::Hash::Writer';
44babf1f 9
10sub _adds_members { 0 }
11
12sub _potential_value {
53a4677c 13 my $self = shift;
14 my ($slot_access) = @_;
15
16 return '(do { '
17 . 'my %potential = %{ (' . $slot_access . ') }; '
18 . '@return = delete @potential{@_}; '
19 . '\%potential; '
20 . '})';
44babf1f 21}
22
a486d5ad 23sub _inline_optimized_set_new_value {
53a4677c 24 my $self = shift;
25 my ($inv, $new, $slot_access) = @_;
44babf1f 26
a486d5ad 27 return '@return = delete @{ (' . $slot_access . ') }{@_};';
7f5ec80d 28}
29
30sub _return_value {
53a4677c 31 my $self = shift;
32 my ($slot_access) = @_;
7f5ec80d 33
53a4677c 34 return 'wantarray ? @return : $return[-1]';
44babf1f 35}
36
8b9641b8 37no Moose::Role;
38
44babf1f 391;