BIMI/Record.pm

filter: Statementstmt 76.9% 140 / 182 Branchbran 56.0% 56 / 100 Conditioncond 17.5% 10 / 57 MC/DCmcdc 8.8% 3 / 34 Subroutinesub 94.4% 17 / 18 Podpod 100% 4 / 4 totaltotal 58.2% 230 / 395 CC 78 SCAR 48.8
CC
78
Cov
61%
app_validate
380.0
_build_is_valid
175.5
location_is_relevant
13.3
CRAP 131.3
« BIMI/VMC/Chain.pm ↑ Summary BIMI/VMC.pm »
1 package Mail::BIMI::Record;
2 # ABSTRACT: Class to model a BIMI record
3 29 our $VERSION = '3.20261116'; # VERSION
4 29 ▶use 5.20.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 29 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 29 ▶use Mail::BIMI::Prelude;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 29 ▶use Term::ANSIColor qw{ :constants };
Subroutine BEGIN: called CC=1 SCAR=0.0
8 29 ▶use Mail::BIMI::Record::Authority;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 29 ▶use Mail::BIMI::Record::Location;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 29 ▶use Mail::DMARC::PurePerl;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 29 extends 'Mail::BIMI::Base';
13 29 with(
14 'Mail::BIMI::Role::HasError',
15 'Mail::BIMI::Role::Cacheable',
16 );
17 29 has domain => ( is => 'rw', isa => 'Str', required => 1, traits => ['CacheKey'],
18 documentation => 'inputs: Domain the for the record', );
19 29 has retrieved_domain => ( is => 'rw', isa => 'Str', traits => ['Cacheable'],
20 documentation => 'Domain the record was retrieved from', );
21 29 has retrieved_record => ( is => 'rw', traits => ['Cacheable'],
22 documentation => 'Record as retrieved' );
23 29 has retrieved_selector => ( is => 'rw', isa => 'Str', traits => ['Cacheable'],
24 documentation => 'Selector the record was retrieved from', );
25 29 has selector => ( is => 'rw', isa => 'Str', traits => ['CacheKey'],
26 documentation => 'inputs: Selector used to retrieve the record; will become default if fallback was used', );
27 29 has version => ( is => 'rw', isa => 'Maybe[Str]', lazy => 1, builder => '_build_version', traits => ['Cacheable'],
28 documentation => 'BIMI Version tag' );
29 29 has authority => ( is => 'rw', isa => 'Mail::BIMI::Record::Authority', lazy => 1, builder => '_build_authority',
30 documentation => 'Mail::BIMI::Record::Authority object for this record' );
31 29 has location => ( is => 'rw', isa => 'Mail::BIMI::Record::Location', lazy => 1, builder => '_build_location',
32 documentation => 'Mail::BIMI::Record::Location object for this record' );
33 29 has record_hashref => ( is => 'rw', isa => 'HashRef', lazy => 1, builder => '_build_record_hashref', traits => ['Cacheable'],
34 documentation => 'Hashref of record values' );
35 29 has is_valid => ( is => 'rw', lazy => 1, builder => '_build_is_valid', traits => ['Cacheable'],
36 documentation => 'Is this record valid' );
37  
38  
39  
40 6 ▶sub cache_valid_for($self) { return 3600 }
Subroutine cache_valid_for: called CC=1 SCAR=0.0
Pod documented
41  
42 31 ▶sub _build_version($self) {
Subroutine _build_version: called CC=2 SCAR=6.9
43 31 ▶ if ( !exists $self->record_hashref->{v} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->record_hashref->{"v"}) 1 30 31
44 1 return undef;
45 }
46 30 return $self->record_hashref->{v};
47 }
48  
49 36 ▶sub _build_authority($self) {
Subroutine _build_authority: called CC=3 SCAR=11.0
50 36 my $uri;
51 36 ▶ if ( exists $self->record_hashref->{a} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->record_hashref->{"a"}) 3 33 36
52 3 ▶ $uri = $self->record_hashref->{a} // '';
Condition50%1/2
$self->record_hashref->{"a"} // ""
l!l
30
MC/DC0%0/1
$self->record_hashref->{"a"} // ""
$self->record_hashref->{"a"}
Truth table50%1/2
A
A= $self->record_hashref->{"a"}
Aresult
11
00
53 }
54 # TODO better parser here
55 36 return Mail::BIMI::Record::Authority->new( uri => $uri, bimi_object => $self->bimi_object );
56 }
57  
58 30 ▶sub _build_location($self) {
Subroutine _build_location: called CC=3 SCAR=11.0
59 30 my $uri;
60 30 ▶ if ( exists $self->record_hashref->{l} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->record_hashref->{"l"}) 25 5 30
61 25 ▶ $uri = $self->record_hashref->{l} // '';
Condition50%1/2
$self->record_hashref->{"l"} // ""
l!l
250
MC/DC0%0/1
$self->record_hashref->{"l"} // ""
$self->record_hashref->{"l"}
Truth table50%1/2
A
A= $self->record_hashref->{"l"}
Aresult
11
00
62 }
63 # TODO better parser here
64 # Need to decode , and ; as per spec>
65 30 my $location = Mail::BIMI::Record::Location->new( uri => $uri, is_relevant => $self->location_is_relevant, bimi_object => $self->bimi_object );
66 30 return $location;
67 }
68  
69  
70 56 ▶sub location_is_relevant($self) {
Subroutine location_is_relevant: called CC=4 SCAR=25.8
Pod documented
71 # True if we don't have a relevant authority OR if we are checking VMC AND Location
72 56 ▶ return 1 unless $self->bimi_object->options->no_location_with_vmc;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->bimi_object->options->no_location_with_vmc 56 0 56
73 0 ▶ if ( $self->authority && $self->authority->is_relevant ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->authority and $self->authority->is_relevant) 0 0 0
Condition0%0/3
$self->authority and $self->authority->is_relevant
!ll&&!rl&&r
000
MC/DC0%0/2
$self->authority and $self->authority->is_relevant
$self->authority $self->authority->is_relevant
Truth table0%0/3
A and B
A= $self->authorityB= $self->authority->is_relevant
ABresult
0X0
100
111
74 0 $self->log_verbose('Location is not relevant');
75 0 return 0;
76 }
77 0 return 1;
78 }
79  
80 38 ▶sub _build_is_valid($self) {
Subroutine _build_is_valid: called CC=28 SCAR=51.7
81 38 ▶ return 0 if ! keys $self->record_hashref->%*;
Branch: 1 branch
BranchTrueFalseTotal
unless keys %{$self->record_hashref} 7 31 38
82  
83 31 ▶ if ( !defined $self->version ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $self->version) { } 1 30 31
84 1 $self->add_error('MISSING_V_TAG');
85 1 return 0;
86 }
87 else {
88 30 ▶ $self->add_error('EMPTY_V_TAG') if lc $self->version eq '';
Branch: 1 branch
BranchTrueFalseTotal
if lc $self->version eq "" 1 29 30
89 30 ▶ $self->add_error('INVALID_V_TAG') if lc $self->version ne 'bimi1';
Branch: 1 branch
BranchTrueFalseTotal
if lc $self->version ne "bimi1" 4 26 30
90 30 ▶ return 0 if $self->errors->@*;
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->errors} 4 26 30
91 }
92 26 ▶ if ($self->authority->is_relevant && !$self->authority->is_valid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->authority->is_relevant and not $self->authority->is_valid) 0 26 26
Condition33%1/3
$self->authority->is_relevant and not $self->authority->is_valid
!ll&&!rl&&r
2600
MC/DC0%0/2
$self->authority->is_relevant and not $self->authority->is_valid
$self->authority->is_relevant not $self->authority->is_valid
Truth table33%1/3
A and not(B)
A= $self->authority->is_relevantB= not $self->authority->is_valid
ABresult
0X0
100
111
93 0 $self->add_error_object( $self->authority->errors );
94 }
95 26 ▶ if ($self->location_is_relevant && !$self->location->is_valid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->location_is_relevant and not $self->location->is_valid) 3 23 26
Condition66%2/3
$self->location_is_relevant and not $self->location->is_valid
!ll&&!rl&&r
0233
MC/DC50%1/2
$self->location_is_relevant and not $self->location->is_valid
$self->location_is_relevant not $self->location->is_valid
Truth table66%2/3
A and not(B)
A= $self->location_is_relevantB= not $self->location->is_valid
ABresult
0X0
100
111
96 3 $self->add_error_object( $self->location->errors );
97 }
98  
99 26 ▶ return 0 if $self->errors->@*;
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->errors} 3 23 26
100  
101 23 ▶ if ( $self->bimi_object->options->require_vmc ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->bimi_object->options->require_vmc) 0 23 23
102 0 ▶ unless ( $self->authority && $self->authority->vmc && $self->authority->vmc->is_valid ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->authority and $self->authority->vmc and $self->authority->vmc->is_valid) 0 0 0
Condition0%0/6
$self->authority and $self->authority->vmc and $self->authority->vmc->is_valid
!ll&&!rl&&r
000
$self->authority and $self->authority->vmc
!ll&&!rl&&r
000
MC/DC0%0/3
$self->authority and $self->authority->vmc and $self->authority->vmc->is_valid
$self->authority $self->authority->vmc $self->authority->vmc->is_valid
Truth table0%0/4
A and B and C
A= $self->authorityB= $self->authority->vmcC= $self->authority->vmc->is_valid
ABCresult
0XX0
10X0
1100
1111
103 0 $self->add_error('VMC_REQUIRED');
104 }
105 }
106  
107 23 ▶ if ( $self->authority && $self->authority->is_relevant ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->authority and $self->authority->is_relevant) 0 23 23
Condition33%1/3
$self->authority and $self->authority->is_relevant
!ll&&!rl&&r
0230
MC/DC0%0/2
$self->authority and $self->authority->is_relevant
$self->authority $self->authority->is_relevant
Truth table33%1/3
A and B
A= $self->authorityB= $self->authority->is_relevant
ABresult
0X0
100
111
108 # Check the SVG payloads are identical
109 ## Compare raw? or Uncompressed?
110 0 ▶ if ( !$self->authority->vmc ) {
Branch: 6 branches
BranchTrueFalseTotal
if (not $self->authority->vmc) { } 0 0 0
elsif (not $self->authority->vmc->indicator) { } 0 0 0
elsif ($self->location_is_relevant and not $self->location) { } 0 0 0
elsif ($self->location_is_relevant and not $self->location->indicator) { } 0 0 0
elsif ($self->location_is_relevant and $self->authority->vmc->indicator->data_uncompressed_normalized ne $self->location->indicator->data_uncompressed_normalized) { } 0 0 0
elsif ($self->location_is_relevant and $self->authority->vmc->indicator->data_uncompressed ne $self->location->indicator->data_uncompressed) { } 0 0 0
111 # We could not get a vmc to check, return an error.
112 0 $self->add_error('VMC_PARSE_ERROR');
113 }
114 elsif ( !$self->authority->vmc->indicator ) {
115 # We could not get an indicator from the vmc to check, return an error.
116 0 $self->add_error('VMC_PARSE_ERROR','Could not extract SVG from VMC');
117 }
118 ▶ elsif ( $self->location_is_relevant && !$self->location ) {
Condition0%0/3
$self->location_is_relevant and not $self->location
!ll&&!rl&&r
000
MC/DC0%0/2
$self->location_is_relevant and not $self->location
$self->location_is_relevant not $self->location
Truth table0%0/3
A and not(B)
A= $self->location_is_relevantB= not $self->location
ABresult
0X0
100
111
119 # We could not get a location to check against, return an error.
120 0 $self->add_error('SVG_MISMATCH');
121 }
122 ▶ elsif ( $self->location_is_relevant && !$self->location->indicator ) {
Condition0%0/3
$self->location_is_relevant and not $self->location->indicator
!ll&&!rl&&r
000
MC/DC0%0/2
$self->location_is_relevant and not $self->location->indicator
$self->location_is_relevant not $self->location->indicator
Truth table0%0/3
A and not(B)
A= $self->location_is_relevantB= not $self->location->indicator
ABresult
0X0
100
111
123 # We could not get an indicator from the location to check against, return an error.
124 0 $self->add_error('SVG_MISMATCH');
125 }
126 ▶ elsif ( $self->location_is_relevant && $self->authority->vmc->indicator->data_uncompressed_normalized ne $self->location->indicator->data_uncompressed_normalized ) {
Condition0%0/3
$self->location_is_relevant and $self->authority->vmc->indicator->data_uncompressed_normalized ne $self->location->indicator->data_uncompressed_normalized
!ll&&!rl&&r
000
MC/DC0%0/2
$self->location_is_relevant and $self->authority->vmc->indicator->data_uncompressed_normalized ne $self->location->indicator->data_uncompressed_normalized
$self->location_is_relevant $self->authority->vmc->indicator->data_uncompressed_normalized ne $self->location->indicator->data_uncompressed_normalized
Truth table0%0/3
A and B
A= $self->location_is_relevantB= $self->authority->vmc->indicator->data_uncompressed_normalized ne $self->location->indicator->data_uncompressed_normalized
ABresult
0X0
100
111
127 0 $self->add_error('SVG_MISMATCH');
128 }
129 ▶ elsif ( $self->location_is_relevant && $self->authority->vmc->indicator->data_uncompressed ne $self->location->indicator->data_uncompressed ) {
Condition0%0/3
$self->location_is_relevant and $self->authority->vmc->indicator->data_uncompressed ne $self->location->indicator->data_uncompressed
!ll&&!rl&&r
000
MC/DC0%0/2
$self->location_is_relevant and $self->authority->vmc->indicator->data_uncompressed ne $self->location->indicator->data_uncompressed
$self->location_is_relevant $self->authority->vmc->indicator->data_uncompressed ne $self->location->indicator->data_uncompressed
Truth table0%0/3
A and B
A= $self->location_is_relevantB= $self->authority->vmc->indicator->data_uncompressed ne $self->location->indicator->data_uncompressed
ABresult
0X0
100
111
130 0 $self->add_warning('Line encoding for SVG in bimi-location did not match SVG in VMC');
131 }
132 }
133  
134 23 ▶ return 0 if $self->errors->@*;
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->errors} 0 23 23
135 23 $self->log_verbose('Record is valid');
136 23 return 1;
137 }
138  
139 26 ▶sub _build_record_hashref($self) {
Subroutine _build_record_hashref: called CC=9 SCAR=22.0
140 26 my $domain = $self->domain;
141 26 my $selector = $self->selector;
142 26 my $fallback_selector = $self->selector;
143 26 my $fallback_domain = Mail::DMARC::PurePerl->new->get_organizational_domain($domain);
144  
145 26 my @records;
146 eval {
147 26 @records = $self->_get_from_dns($selector,$domain);
148 25 1;
149 26 ▶ } || do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { @records = $self->_get_from_dns($selector, $domain); 1 } } or do { my $error = $@; $error =~ s[ at /.*$][]su; $self->add_error("DNS_ERROR", $error); return {} } 25 1 26
150 1 my $error = $@;
151 1 $error =~ s/ at \/.*$//s;
152 1 $self->add_error('DNS_ERROR',$error);
153 1 return {};
154 };
155  
156 25 @records = grep { $_ =~ /^v\s*=\s*bimi1;/i } @records;
157  
158 25 ▶ if ( !@records ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not @records) { } 6 19 25
elsif (scalar @records > 1) { } 1 18 19
159 6 ▶ if ( $domain eq $fallback_domain && $selector eq $fallback_selector ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($domain eq $fallback_domain and $selector eq $fallback_selector) 2 4 6
Condition66%2/3
$domain eq $fallback_domain and $selector eq $fallback_selector
!ll&&!rl&&r
402
MC/DC50%1/2
$domain eq $fallback_domain and $selector eq $fallback_selector
$domain eq $fallback_domain $selector eq $fallback_selector
Truth table66%2/3
A and B
A= $domain eq $fallback_domainB= $selector eq $fallback_selector
ABresult
0X0
100
111
160 # nothing to fall back to
161 2 $self->add_error('NO_BIMI_RECORD');
162 2 return {};
163 }
164  
165 4 $self->log_verbose('Trying fallback domain');
166 4 my @records;
167 eval {
168 4 @records = $self->_get_from_dns($fallback_selector,$fallback_domain);
169 3 1;
170 4 ▶ } || do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { @records = $self->_get_from_dns($fallback_selector, $fallback_domain); 1 } } or do { my $error = $@; $error =~ s[ at /.*$][]u; $self->add_error("DNS_ERROR", $error); return {} } 3 1 4
171 1 my $error = $@;
172 1 $error =~ s/ at \/.*$//;
173 1 $self->add_error('DNS_ERROR',$error);
174 1 return {};
175 };
176  
177 3 @records = grep { $_ =~ /^v\s*=\s*bimi1;/i } @records;
178  
179 3 ▶ if ( !@records ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not @records) { } 0 3 3
elsif (scalar @records > 1) { } 1 2 3
180 0 $self->add_error('NO_BIMI_RECORD');
181 0 return {};
182 }
183 elsif ( scalar @records > 1 ) {
184 1 $self->add_error('MULTI_BIMI_RECORD');
185 1 return {};
186 }
187 else {
188 # We have one record, let's use that.
189 2 $self->retrieved_record($records[0]);
190 2 $self->retrieved_domain($fallback_domain);
191 2 $self->retrieved_selector($fallback_selector);
192 2 return $self->_parse_record($records[0]);
193 }
194 }
195 elsif ( scalar @records > 1 ) {
196 1 $self->add_error('MULTI_BIMI_RECORD');
197 1 return {};
198 }
199 else {
200 # We have one record, let's use that.
201 18 $self->retrieved_record($records[0]);
202 18 $self->retrieved_domain($domain);
203 18 $self->retrieved_selector($selector);
204 18 return $self->_parse_record($records[0]);
205 }
206 }
207  
208 30 ▶sub _get_from_dns($self,$selector,$domain) {
Subroutine _get_from_dns: called CC=11 SCAR=25.1
209 30 my @matches;
210 my $cname;
211 30 ▶ if ($self->bimi_object->options->force_record) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->bimi_object->options->force_record) 0 30 30
212 0 $self->log_verbose('Using fake record');
213 0 push @matches, $self->bimi_object->options->force_record;
214 0 return @matches;
215 }
216 30 my $res = $self->bimi_object->resolver;
217 30 ▶ my $query = $res->query( "$selector._bimi.$domain", 'TXT' ) or do {
Branch: 1 branch
BranchTrueFalseTotal
my $query = $res->query("$selector._bimi.$domain", "TXT") or do { return @matches } 22 6 28
218 6 return @matches;
219 };
220 22 for my $rr ( $query->answer ) {
221 24 ▶ $cname = $rr->cname if $rr->type eq 'CNAME';
Branch: 1 branch
BranchTrueFalseTotal
if $rr->type eq "CNAME" 1 23 24
222 24 ▶ next if $rr->type ne 'TXT';
Branch: 1 branch
BranchTrueFalseTotal
if $rr->type ne "TXT" 1 23 24
223 23 push @matches, scalar $rr->txtdata;
224 }
225  
226 22 ▶ if (!@matches && $cname) {
Branch: 1 branch
BranchTrueFalseTotal
if (not @matches and $cname) 1 21 22
Condition66%2/3
not @matches and $cname
!ll&&!rl&&r
2101
MC/DC50%1/2
not @matches and $cname
not @matches $cname
Truth table66%2/3
not(A) and B
A= not @matchesB= $cname
ABresult
0X0
100
111
227 # follow a single CNAME
228 1 ▶ $query = $res->query( $cname, 'TXT' ) or do {
Branch: 1 branch
BranchTrueFalseTotal
$query = $res->query($cname, "TXT") or do { return @matches } 1 0 1
229 0 return @matches;
230 };
231 1 for my $rr ( $query->answer ) {
232 1 ▶ next if $rr->type ne 'TXT';
Branch: 1 branch
BranchTrueFalseTotal
if $rr->type ne "TXT" 0 1 1
233 1 push @matches, scalar $rr->txtdata;
234 }
235 }
236  
237 22 return @matches;
238 }
239  
240 37 ▶sub _parse_record($self,$record) {
Subroutine _parse_record: called CC=5 SCAR=16.1
241 37 my $data = {};
242  
243 # A BIMI record may only contain ASCII printable characters
244 37 ▶ unless ($record =~ /^ [ \x20-\x7e ]+ $/xx) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($record =~ /^ [ \x20-\x7e ]+ $/uxx) 1 36 37
245 1 $self->add_error('INVALID_RECORD');
246 1 return $data;
247 }
248  
249 36 my @parts = split ';', $record;
250 36 foreach my $part ( @parts ) {
251 74 $part =~ s/^ +//;
252 74 $part =~ s/ +$//;
253 74 my ( $key, $value ) = split '\s*=\s*', $part, 2;
254 74 $key = lc $key;
255 74 ▶ if ( exists $data->{ $key } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $data->{$key}) 1 73 74
256 1 $self->add_error('DUPLICATE_KEY');
257 }
258 74 ▶ if ( grep { $key eq $_ } ( qw{ v l a } ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$key eq $_;} "v", "l", "a") 74 0 74
259 74 $data->{$key} = $value;
260 }
261 }
262 36 return $data;
263 }
264  
265  
266 5 ▶sub finish($self) {
Subroutine finish: called CC=3 SCAR=11.7
Pod documented
267 5 ▶ $self->authority->finish if $self->authority;
Branch: 1 branch
BranchTrueFalseTotal
if $self->authority 5 0 5
268 5 ▶ $self->location->finish if $self->location;
Branch: 1 branch
BranchTrueFalseTotal
if $self->location 5 0 5
269 5 $self->_write_cache;
270 }
271  
272  
273 0 ▶sub app_validate($self) {
Subroutine app_validate: not called CC=19 SCAR=59.4
Pod documented
274 0 ▶ say 'Record Returned: '.($self->is_valid ? GREEN."\x{2713}" : BRIGHT_RED."\x{26A0}").RESET;
Branch: 1 branch
BranchTrueFalseTotal
$self->is_valid ? : 0 0 0
275 0 $self->is_valid; # To set retrieved record and retrieved domain/selector
276 0 ▶ say YELLOW.' Record : '.($self->retrieved_record//'-none-').RESET;
Condition0%0/2
$self->retrieved_record // "-none-"
l!l
00
MC/DC0%0/1
$self->retrieved_record // "-none-"
$self->retrieved_record
Truth table0%0/2
A
A= $self->retrieved_record
Aresult
11
00
277 0 ▶ if ($self->retrieved_record){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->retrieved_record) 0 0 0
278 0 ▶ say YELLOW.' Version '.WHITE.': '.CYAN.($self->version//'-none-').RESET;
Condition0%0/2
$self->version // "-none-"
l!l
00
MC/DC0%0/1
$self->version // "-none-"
$self->version
Truth table0%0/2
A
A= $self->version
Aresult
11
00
279 0 ▶ say YELLOW.' Domain '.WHITE.': '.CYAN.($self->retrieved_domain//'-none-').RESET;
Condition0%0/2
$self->retrieved_domain // "-none-"
l!l
00
MC/DC0%0/1
$self->retrieved_domain // "-none-"
$self->retrieved_domain
Truth table0%0/2
A
A= $self->retrieved_domain
Aresult
11
00
280 0 ▶ say YELLOW.' Selector '.WHITE.': '.CYAN.($self->retrieved_selector//'-none-').RESET;
Condition0%0/2
$self->retrieved_selector // "-none-"
l!l
00
MC/DC0%0/1
$self->retrieved_selector // "-none-"
$self->retrieved_selector
Truth table0%0/2
A
A= $self->retrieved_selector
Aresult
11
00
281 0 ▶ say YELLOW.' Authority '.WHITE.': '.CYAN.($self->authority->uri//'-none-').RESET if $self->authority;
Branch: 1 branch
BranchTrueFalseTotal
if $self->authority 0 0 0
Condition0%0/2
$self->authority->uri // "-none-"
l!l
00
MC/DC0%0/1
$self->authority->uri // "-none-"
$self->authority->uri
Truth table0%0/2
A
A= $self->authority->uri
Aresult
11
00
282 0 ▶ say YELLOW.' Location '.WHITE.': '.CYAN.($self->location->uri//'-none-').RESET if $self->location_is_relevant && $self->location;
Branch: 1 branch
BranchTrueFalseTotal
if $self->location_is_relevant and $self->location 0 0 0
Condition0%0/5
$self->location_is_relevant and $self->location
!ll&&!rl&&r
000
$self->location->uri // "-none-"
l!l
00
MC/DC0%0/2
$self->location_is_relevant and $self->location
$self->location_is_relevant $self->location
MC/DC0%0/1
$self->location->uri // "-none-"
$self->location->uri
Truth table0%0/3
A and B
A= $self->location_is_relevantB= $self->location
ABresult
0X0
100
111
Truth table0%0/2
A
A= $self->location->uri
Aresult
11
00
283 0 ▶ say YELLOW.' Is Valid '.WHITE.': '.($self->is_valid?GREEN.'Yes':BRIGHT_RED.'No').RESET;
Branch: 1 branch
BranchTrueFalseTotal
$self->is_valid ? : 0 0 0
284 }
285  
286 0 ▶ if ( $self->warnings->@* ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->warnings}) 0 0 0
287 0 say "Warnings:";
288 0 foreach my $warning ( $self->warnings->@* ) {
289 0 say CYAN.' '.$warning.RESET;
290 }
291 }
292  
293 0 ▶ if ( ! $self->is_valid ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->is_valid) 0 0 0
294 0 say "Errors:";
295 0 foreach my $error ( $self->errors->@* ) {
296 0 my $error_code = $error->code;
297 0 my $error_text = $error->description;
298 0 ▶ my $error_detail = $error->detail // '';
Condition0%0/2
$error->detail // ""
l!l
00
MC/DC0%0/1
$error->detail // ""
$error->detail
Truth table0%0/2
A
A= $error->detail
Aresult
11
00
299 0 $error_detail =~ s/\n/\n /g;
300 0 ▶ say BRIGHT_RED." $error_code ".WHITE.': '.CYAN.$error_text.($error_detail?"\n ".$error_detail:'').RESET;
Branch: 1 branch
BranchTrueFalseTotal
$error_detail ? : 0 0 0
301 }
302 }
303 }
304  
305 29 1;
306  
307 __END__
« BIMI/VMC/Chain.pm ↑ Summary BIMI/VMC.pm »