Commit | Line | Data |
44babf1f |
1 | package Moose::Meta::Method::Accessor::Native::Hash::delete; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
10bd99ec |
6 | our $VERSION = '1.14'; |
44babf1f |
7 | $VERSION = eval $VERSION; |
8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | |
8b9641b8 |
10 | use Moose::Role; |
11 | |
12 | with 'Moose::Meta::Method::Accessor::Native::Hash::Writer' => |
13 | { -excludes => ['_inline_optimized_set_new_value'] }; |
44babf1f |
14 | |
15 | sub _adds_members { 0 } |
16 | |
17 | sub _potential_value { |
18 | my ( $self, $slot_access ) = @_; |
19 | |
20 | return "( do { my \%potential = %{ $slot_access }; delete \@potential{\@_}; \\\%potential; } )"; |
21 | } |
22 | |
23 | sub _inline_optimized_set_new_value { |
24 | my ( $self, $inv, $new, $slot_access ) = @_; |
25 | |
584540d9 |
26 | return "delete \@{ $slot_access }{\@_}"; |
44babf1f |
27 | } |
28 | |
8b9641b8 |
29 | no Moose::Role; |
30 | |
44babf1f |
31 | 1; |