File Coverage

blib/lib/Mail/Colander/AnnotationBuiltins.pm
Criterion Covered Total %
statement 11 31 35.4
branch 0 4 0.0
condition 0 2 0.0
subroutine 4 7 57.1
pod 3 3 100.0
total 18 47 38.3


line stmt bran cond sub pod time code
1             package Mail::Colander::AnnotationBuiltins;
2 1     1   3187 use v5.24;
  1         3  
3 1     1   4 use utf8;
  1         1  
  1         7  
4 1     1   27 use experimental qw< signatures >;
  1         1  
  1         5  
5 1     1   599 use Net::Subnet;
  1         6891  
  1         350  
6             { our $VERSION = '0.004' }
7              
8 0     0 1   sub factory ($parse_ctx, $name) {
  0            
  0            
  0            
9 0           state $intermediate_for = {
10             is_element_of => \&set_is_element_of,
11             '∈' => \&set_is_element_of,
12             contains => \&set_contains,
13             '∋' => \&set_contains,
14             subnet_matcher => \&subnet_matcher,
15             };
16 0   0       return $intermediate_for->{$name} // undef;
17             }
18              
19 0     0 1   sub set_contains ($set, $target) {
  0            
  0            
  0            
20 0           warn "set contains set<$set> target<$target>";
21 0 0         return defined($set->($target)) if ref($set) eq 'CODE';
22 0 0         for my $item ($set->@*) { return 1 if $item eq $target }
  0            
23 0           return 0;
24             }
25              
26 0     0 1   sub set_is_element_of ($elem, $set) { return set_contains($set, $elem) }
  0            
  0            
  0            
  0            
27              
28             1;