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.2205';
3              
4 5     5   3558 use strict;
  5         15  
  5         174  
5 5     5   30 use warnings;
  5         12  
  5         160  
6              
7 5     5   31 use Moose::Role;
  5         11  
  5         46  
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   59 sub _inline_coerce_new_values { '' }
16              
17 9     9   39 sub _check_new_members_only { 0 }
18              
19             sub _potential_value {
20 13     13   35 my $self = shift;
21 13         43 my ($slot_access) = @_;
22              
23 13         68 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   24 my $self = shift;
32 8         28 my ($inv, $new, $slot_access) = @_;
33              
34 8         58 return '@return = delete @{ (' . $slot_access . ') }{@_};';
35             }
36              
37             sub _return_value {
38 26     26   64 my $self = shift;
39 26         66 my ($slot_access) = @_;
40              
41 26         106 return 'wantarray ? @return : $return[-1]';
42             }
43              
44 5     5   54 no Moose::Role;
  5         15  
  5         31  
45              
46             1;