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.2203';
3              
4 5     5   3182 use strict;
  5         15  
  5         170  
5 5     5   28 use warnings;
  5         12  
  5         146  
6              
7 5     5   24 use Moose::Role;
  5         13  
  5         38  
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   53 sub _inline_coerce_new_values { '' }
16              
17 9     9   30 sub _check_new_members_only { 0 }
18              
19             sub _potential_value {
20 13     13   32 my $self = shift;
21 13         48 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   19 my $self = shift;
32 8         25 my ($inv, $new, $slot_access) = @_;
33              
34 8         61 return '@return = delete @{ (' . $slot_access . ') }{@_};';
35             }
36              
37             sub _return_value {
38 26     26   54 my $self = shift;
39 26         54 my ($slot_access) = @_;
40              
41 26         105 return 'wantarray ? @return : $return[-1]';
42             }
43              
44 5     5   45 no Moose::Role;
  5         16  
  5         48  
45              
46             1;