File Coverage

blib/lib/Mail/Colander.pm
Criterion Covered Total %
statement 20 26 76.9
branch n/a
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 28 35 80.0


line stmt bran cond sub pod time code
1             package Mail::Colander;
2 1     1   269342 use v5.24;
  1         3  
3 1     1   565 use Moo;
  1         6827  
  1         13  
4 1     1   1729 use experimental qw< signatures >;
  1         1269  
  1         6  
5             { our $VERSION = '0.004' }
6              
7 1     1   724 use Data::Annotation;
  1         83629  
  1         48  
8 1     1   9 use Storable qw< dclone >;
  1         5  
  1         134  
9 1     1   8 use Scalar::Util qw< blessed >;
  1         1  
  1         52  
10              
11 1     1   6 use namespace::clean;
  1         2  
  1         6  
12              
13             has annotator => (
14             is => 'ro',
15             coerce => sub ($in) {
16             return $in if blessed($in);
17             $in = dclone($in);
18             #use Data::Dumper; $Data::Dumper::Indent = $Data::Dumper::Sortkeys = 1;
19             #die Dumper($in);
20             my $parse_ctx = $in->{'condition-parse-context'} //= {};
21             my $prefixes = $parse_ctx->{'locator-relative-prefixes'} //= [];
22             push $prefixes->@*, 'Mail::Colander::AnnotationBuiltins';
23             return Data::Annotation->new($in)->inflate_chains;
24             },
25             handles => [qw< description has_chain_for >]
26             );
27              
28 0     0 1   sub policy_for ($self, $chain, $element) {
  0            
  0            
  0            
  0            
29 0           return $self->annotator->evaluate($chain, $element);
30             }
31              
32             1;