File Coverage

blib/lib/Moose/Meta/Method/Accessor/Native/Hash/delete.pm
Criterion Covered Total %
statement 23 24 95.8
branch n/a
condition n/a
subroutine 9 10 90.0
pod n/a
total 32 34 94.1


line stmt bran cond sub pod time code
1             package Moose::Meta::Method::Accessor::Native::Hash::delete;
2             our $VERSION = '2.2206';
3              
4 5     5   3431 use strict;
  5         18  
  5         171  
5 5     5   36 use warnings;
  5         16  
  5         177  
6              
7 5     5   31 use Moose::Role;
  5         13  
  5         42  
8              
9             with 'Moose::Meta::Method::Accessor::Native::Hash::Writer';
10              
11 0     0   0 sub _adds_members { 0 }
12              
13             # There are no new members so we don't need to coerce new values (none exist)
14             # and we always want to check the new (empty) hash as a whole.
15 13     13   60 sub _inline_coerce_new_values { '' }
16              
17 9     9   47 sub _check_new_members_only { 0 }
18              
19             sub _potential_value {
20 13     13   42 my $self = shift;
21 13         37 my ($slot_access) = @_;
22              
23 13         72 return '(do { '
24             . 'my %potential = %{ (' . $slot_access . ') }; '
25             . '@return = delete @potential{@_}; '
26             . '\%potential; '
27             . '})';
28             }
29              
30             sub _inline_optimized_set_new_value {
31 8     8   23 my $self = shift;
32 8         33 my ($inv, $new, $slot_access) = @_;
33              
34 8         54 return '@return = delete @{ (' . $slot_access . ') }{@_};';
35             }
36              
37             sub _return_value {
38 26     26   71 my $self = shift;
39 26         66 my ($slot_access) = @_;
40              
41 26         111 return 'wantarray ? @return : $return[-1]';
42             }
43              
44 5     5   43 no Moose::Role;
  5         34  
  5         39  
45              
46             1;