Sisimai/Lhost/Activehunter.pm

filter: Statementstmt 95.4% 42 / 44 Branchbran 80.0% 16 / 20 Conditioncond 61.1% 11 / 18 MC/DCmcdc 36.3% 4 / 11 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 80.2% 81 / 101 CC 19 SCAR 28.4
CC
19
Cov
84%
inquire
21.4
BEGIN
1.0
BEGIN
1.0
CRAP 17.2
« Sisimai/Lhost/GoogleWorkspace.pm ↑ Summary Sisimai/Lhost/X6.pm »
1 package Sisimai::Lhost::Activehunter;
2 36 ▶use parent 'Sisimai::Lhost';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 36 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 36 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 36 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶sub description { 'TransWARE Active!hunter' };
Subroutine description: called CC=1 SCAR=0.0
Pod documented
8 878 ▶sub inquire {
Subroutine inquire: called CC=19 SCAR=30.6
Pod documented
9 # Detect an error from QUALITIA Active!hunter
10 # @param [Hash] mhead Message headers of a bounce email
11 # @param [String] mbody Message body of a bounce email
12 # @return [Hash] Bounce data list and message/rfc822 part
13 # @return [undef] failed to decode or the arguments are missing
14 # @since v4.1.1
15 878 my $class = shift;
16 878 ▶ my $mhead = shift // return undef; return undef unless defined $mhead->{'x-ahmailid'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mhead->{"x-ahmailid"} 866 11 877
Condition100%2/2
shift() // (return undef)
l!l
8771
MC/DC100%1/1
shift() // (return undef)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
17 11 ▶ my $mbody = shift // return undef;
Condition50%1/2
shift() // (return undef)
l!l
110
MC/DC0%0/1
shift() // (return undef)
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
18  
19 11 state $indicators = __PACKAGE__->INDICATORS;
20 11 state $boundaries = ['Content-Type: message/rfc822'];
21 11 state $startingof = {'message' => [' ----- The following addresses had permanent fatal errors -----']};
22  
23 11 ▶ my $emailparts = Sisimai::RFC5322->part($mbody, $boundaries) // return undef; return undef unless $emailparts->[0];
Branch: 1 branch
BranchTrueFalseTotal
unless $emailparts->[0] 0 11 11
Condition50%1/2
"Sisimai::RFC5322"->part($mbody, $boundaries) // (return undef)
l!l
110
MC/DC0%0/1
"Sisimai::RFC5322"->part($mbody, $boundaries) // (return undef)
"Sisimai::RFC5322"->part($mbody, $boundaries)
Truth table50%1/2
A
A= "Sisimai::RFC5322"->part($mbody, $boundaries)
Aresult
11
00
24 11 my $dscontents = [__PACKAGE__->DELIVERYSTATUS]; my $v = undef;
25 11 my $readcursor = 0; # (Integer) Points the current cursor position
26 11 my $recipients = 0; # (Integer) The number of 'Final-Recipient' header
27  
28 11 for my $e ( split("\n", $emailparts->[0]) ) {
29 # Read error messages and delivery status lines from the head of the email to the previous
30 # line of the beginning of the original message.
31 121 ▶ unless( $readcursor ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($readcursor) 66 55 121
32 # Beginning of the bounce message or delivery status part
33 66 ▶ $readcursor |= $indicators->{'deliverystatus'} if index($e, $startingof->{'message'}->[0]) == 0;
Branch: 1 branch
BranchTrueFalseTotal
if index($e, $startingof->{"message"}[0]) == 0 11 55 66
34 66 next;
35 }
36 55 ▶ next if ($readcursor & $indicators->{'deliverystatus'}) == 0 || $e eq "";
Branch: 1 branch
BranchTrueFalseTotal
if ($readcursor & $indicators->{"deliverystatus"}) == 0 or $e eq "" 22 33 55
Condition66%2/3
($readcursor & $indicators->{"deliverystatus"}) == 0 or $e eq ""
l!l&&r!l&&!r
02233
MC/DC50%1/2
($readcursor & $indicators->{"deliverystatus"}) == 0 or $e eq ""
($readcursor & $indicators->{"deliverystatus"}) == 0 $e eq ""
Truth table66%2/3
A or B
A= ($readcursor & $indicators->{"deliverystatus"}) == 0B= $e eq ""
ABresult
1X1
011
000
37  
38 # ----- The following addresses had permanent fatal errors -----
39 #
40 # >>> kijitora@example.org <kijitora@example.org>
41 #
42 # ----- Transcript of session follows -----
43 # 550 sorry, no mailbox here by that name (#5.1.1 - chkusr)
44 33 $v = $dscontents->[-1];
45  
46 33 ▶ if( index($e, '>>> ') == 0 && index($e, '@') > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($e, '>>> ') == 0 and index($e, '@') > 1) { } 11 22 33
Condition66%2/3
index($e, ">>> ") == 0 and index($e, "\@") > 1
!ll&&!rl&&r
22011
MC/DC50%1/2
index($e, ">>> ") == 0 and index($e, "\@") > 1
index($e, ">>> ") == 0 index($e, "\@") > 1
Truth table66%2/3
A and B
A= index($e, ">>> ") == 0B= index($e, "\@") > 1
ABresult
0X0
100
111
47 # >>> kijitora@example.org <kijitora@example.org>
48 11 ▶ if( $v->{'recipient'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($v->{"recipient"}) 0 11 11
49 # There are multiple recipient addresses in the message body.
50 0 push @$dscontents, __PACKAGE__->DELIVERYSTATUS;
51 0 $v = $dscontents->[-1];
52 }
53 11 $v->{'recipient'} = Sisimai::Address->s3s4(substr($e, index($e, '<'),));
54 11 $recipients++;
55  
56 } else {
57 # ----- Transcript of session follows -----
58 # 550 sorry, no mailbox here by that name (#5.1.1 - chkusr)
59 22 my $p = ord(substr($e, 0, 1));
60 22 ▶ next if $p < 48 || $p > 122;
Branch: 1 branch
BranchTrueFalseTotal
if $p < 48 or $p > 122 11 11 22
Condition66%2/3
$p < 48 or $p > 122
l!l&&r!l&&!r
11011
MC/DC50%1/2
$p < 48 or $p > 122
$p < 48 $p > 122
Truth table66%2/3
A or B
A= $p < 48B= $p > 122
ABresult
1X1
011
000
61 11 ▶ next if length $v->{'diagnosis'};
Branch: 1 branch
BranchTrueFalseTotal
if length $v->{"diagnosis"} 0 11 11
62 11 ▶ $v->{'diagnosis'} ||= $e;
Condition33%1/3
$v->{"diagnosis"} ||= $e
l!l&&r!l&&!r
0110
MC/DC0%0/2
$v->{"diagnosis"} ||= $e
$v->{"diagnosis"} $e
Truth table33%1/3
A ||= B
A= $v->{"diagnosis"}B= $e
ABresult
1X1
011
000
63 }
64 }
65 11 ▶ return undef unless $recipients;
Branch: 1 branch
BranchTrueFalseTotal
unless $recipients 0 11 11
66 11 return {"ds" => $dscontents, "rfc822" => $emailparts->[1]};
67 }
68  
69 36 1;
70 __END__
« Sisimai/Lhost/GoogleWorkspace.pm ↑ Summary Sisimai/Lhost/X6.pm »