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