| 1 | package Sisimai::Reason; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 87 | ▶ | use v5.26; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 87 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 87 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 87 | ▶ | use Sisimai::Eb; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 87 | my $ModulePath = __PACKAGE__->path; | |||||||||||||||||||||||||||||||||||||||||
| 8 | 87 | my $GetRetried = __PACKAGE__->retry; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 87 | my $ClassOrder = [ | |||||||||||||||||||||||||||||||||||||||||
| 10 | # 0. true() meethod in the following reasons are called from Reason->find() | ||||||||||||||||||||||||||||||||||||||||||
| 11 | [$Sisimai::Eb::ReFULL, $Sisimai::Eb::ReSIZE, $Sisimai::Eb::ReQUIT, $Sisimai::Eb::ReMOVE, $Sisimai::Eb::RePASS, | ||||||||||||||||||||||||||||||||||||||||||
| 12 | $Sisimai::Eb::ReAUTH, $Sisimai::Eb::ReUSER, $Sisimai::Eb::ReFILT, $Sisimai::Eb::ReQPTR, $Sisimai::Eb::ReNRFC, | ||||||||||||||||||||||||||||||||||||||||||
| 13 | $Sisimai::Eb::ReFAMA, $Sisimai::Eb::ReBODY, $Sisimai::Eb::ReFROM, $Sisimai::Eb::ReHOST, $Sisimai::Eb::ReSPAM, | ||||||||||||||||||||||||||||||||||||||||||
| 14 | $Sisimai::Eb::ReRATE, $Sisimai::Eb::ReBLOC, $Sisimai::Eb::ReTTLS, $Sisimai::Eb::Re00MX, $Sisimai::Eb::ReEXEC, | ||||||||||||||||||||||||||||||||||||||||||
| 15 | $Sisimai::Eb::ReWONT], | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | # 1. match() method in the following reasons are called from Sisimai::Reason->find() | ||||||||||||||||||||||||||||||||||||||||||
| 18 | [$Sisimai::Eb::ReFULL, $Sisimai::Eb::ReSPAM, $Sisimai::Eb::ReEXEC, $Sisimai::Eb::RePASS, $Sisimai::Eb::RePROC, | ||||||||||||||||||||||||||||||||||||||||||
| 19 | $Sisimai::Eb::ReINET, $Sisimai::Eb::ReQUIT, $Sisimai::Eb::ReDISK, $Sisimai::Eb::ReSTOP, $Sisimai::Eb::ReUNIX, | ||||||||||||||||||||||||||||||||||||||||||
| 20 | $Sisimai::Eb::ReSAFE, $Sisimai::Eb::ReWONT, $Sisimai::Eb::ReCOMM, $Sisimai::Eb::ReTIME], | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | [$Sisimai::Eb::ReFULL, $Sisimai::Eb::ReSIZE, $Sisimai::Eb::ReQUIT, $Sisimai::Eb::ReUSER, $Sisimai::Eb::ReFILT, | ||||||||||||||||||||||||||||||||||||||||||
| 23 | $Sisimai::Eb::ReFROM, $Sisimai::Eb::ReHOST, $Sisimai::Eb::ReSPAM, $Sisimai::Eb::ReRATE, $Sisimai::Eb::ReBLOC, | ||||||||||||||||||||||||||||||||||||||||||
| 24 | $Sisimai::Eb::ReAUTH, $Sisimai::Eb::ReTTLS, $Sisimai::Eb::ReSAFE, $Sisimai::Eb::RePROC, $Sisimai::Eb::ReINET, | ||||||||||||||||||||||||||||||||||||||||||
| 25 | $Sisimai::Eb::ReTIME, $Sisimai::Eb::ReBODY, $Sisimai::Eb::ReMOVE, $Sisimai::Eb::ReDISK, $Sisimai::Eb::Re00MX, | ||||||||||||||||||||||||||||||||||||||||||
| 26 | $Sisimai::Eb::ReUNIX, $Sisimai::Eb::RePASS, $Sisimai::Eb::ReSTOP, $Sisimai::Eb::ReCOMM, $Sisimai::Eb::Re___1], | ||||||||||||||||||||||||||||||||||||||||||
| 27 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 173 | ▶ | sub retry { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
retry: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | # Reason list better to retry detecting an error reason | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # @return [Hash] Reason list | ||||||||||||||||||||||||||||||||||||||||||
| 32 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 173 | $Sisimai::Eb::Re___0 => 1, $Sisimai::Eb::Re___1 => 1, $Sisimai::Eb::RePROC => 1, $Sisimai::Eb::ReSAFE => 1, | |||||||||||||||||||||||||||||||||||||||||
| 34 | $Sisimai::Eb::ReTIME => 1, $Sisimai::Eb::ReINET => 1, $Sisimai::Eb::ReHOST => 1, $Sisimai::Eb::ReUSER => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 35 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 9580 | ▶ | sub is_explicit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_explicit: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | # is_explicit() returns 0 when the argument is empty or is "Undefined" or is "OnHold" | ||||||||||||||||||||||||||||||||||||||||||
| 40 | # @param string argv1 Reason name | ||||||||||||||||||||||||||||||||||||||||||
| 41 | # @return bool false: The reaosn is not explicit | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 9580 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 9580 | ▶ | my $argv1 = shift || return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || (return 0)
MC/DC100%1/1
shift() || (return 0)
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 3744 | ▶ | return 0 if $argv1 eq $Sisimai::Eb::Re___0 || $argv1 eq $Sisimai::Eb::Re___1 || $argv1 eq ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$argv1 eq $Sisimai::Eb::Re___0 or $argv1 eq $Sisimai::Eb::Re___1 or $argv1 eq ""
$argv1 eq $Sisimai::Eb::Re___0 or $argv1 eq $Sisimai::Eb::Re___1
MC/DC66%2/3
$argv1 eq $Sisimai::Eb::Re___0 or $argv1 eq $Sisimai::Eb::Re___1 or $argv1 eq ""
$argv1 eq $Sisimai::Eb::Re___0
$argv1 eq $Sisimai::Eb::Re___1
$argv1 eq ""
Truth table75%3/4
A or B or C
A= $argv1 eq $Sisimai::Eb::Re___0B= $argv1 eq $Sisimai::Eb::Re___1C= $argv1 eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 3681 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 172 | ▶ | sub index { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
index: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | # All the error reason list Sisimai support | ||||||||||||||||||||||||||||||||||||||||||
| 51 | # @return [Array] Reason list | ||||||||||||||||||||||||||||||||||||||||||
| 52 | return [ | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 172 | $Sisimai::Eb::ReAUTH, $Sisimai::Eb::ReFAMA, $Sisimai::Eb::ReBLOC, $Sisimai::Eb::ReBODY, $Sisimai::Eb::ReSENT, | |||||||||||||||||||||||||||||||||||||||||
| 54 | $Sisimai::Eb::ReSIZE, $Sisimai::Eb::ReTIME, $Sisimai::Eb::ReTTLS, $Sisimai::Eb::ReFEED, $Sisimai::Eb::ReFILT, | ||||||||||||||||||||||||||||||||||||||||||
| 55 | $Sisimai::Eb::ReMOVE, $Sisimai::Eb::ReHOST, $Sisimai::Eb::ReFULL, $Sisimai::Eb::ReUNIX, $Sisimai::Eb::ReINET, | ||||||||||||||||||||||||||||||||||||||||||
| 56 | $Sisimai::Eb::RePASS, $Sisimai::Eb::Re00MX, $Sisimai::Eb::ReNRFC, $Sisimai::Eb::Re___1, $Sisimai::Eb::ReWONT, | ||||||||||||||||||||||||||||||||||||||||||
| 57 | $Sisimai::Eb::ReFROM, $Sisimai::Eb::ReQPTR, $Sisimai::Eb::ReRATE, $Sisimai::Eb::ReSAFE, $Sisimai::Eb::ReSPAM, | ||||||||||||||||||||||||||||||||||||||||||
| 58 | $Sisimai::Eb::ReSTOP, $Sisimai::Eb::ReQUIT, $Sisimai::Eb::ReCOMM, $Sisimai::Eb::RePROC, $Sisimai::Eb::ReDISK, | ||||||||||||||||||||||||||||||||||||||||||
| 59 | $Sisimai::Eb::ReUSER, $Sisimai::Eb::ReAWAY, $Sisimai::Eb::ReEXEC, | ||||||||||||||||||||||||||||||||||||||||||
| 60 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 89 | ▶ | sub path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
path: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | # Returns Sisimai::Reason::* module path table | ||||||||||||||||||||||||||||||||||||||||||
| 65 | # @return [Hash] Module path table | ||||||||||||||||||||||||||||||||||||||||||
| 66 | # @since v4.25.6 | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 89 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 89 | my $index = __PACKAGE__->index; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 89 | my $table = {}; $table->{ __PACKAGE__.'::'.$_ } = 'Sisimai/Reason/'.$_.'.pm' for @$index; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 89 | return $table; | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 2502 | ▶ | sub find { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find: called CC=21 SCAR=31.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | # Detect the bounce reason | ||||||||||||||||||||||||||||||||||||||||||
| 75 | # @param [Hash] argvs Decoded email object | ||||||||||||||||||||||||||||||||||||||||||
| 76 | # @return [String] Bounce reason or an empty string if the argument is missing or not HASH | ||||||||||||||||||||||||||||||||||||||||||
| 77 | # @see anotherone | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 2502 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 79 | 2502 | ▶ | my $argvs = shift // return ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() // (return "")
MC/DC100%1/1
shift() // (return "")
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | # Return a reason text already decided except a reason matched with the regular expression of | ||||||||||||||||||||||||||||||||||||||||||
| 82 | # Sisimai::Reason->retry() method. | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 2501 | ▶ | return $argvs->{'reason'} if( (not exists $GetRetried->{ $argvs->{'reason'} }) && $argvs->{'reason'} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not exists $$GetRetried{$argvs->{"reason"}} and $argvs->{"reason"}
MC/DC0%0/2
not exists $$GetRetried{$argvs->{"reason"}} and $argvs->{"reason"}
not exists $$GetRetried{$argvs->{"reason"}}
$argvs->{"reason"}
Truth table66%2/3
not(A) and B
A= not exists $$GetRetried{$argvs->{"reason"}}B= $argvs->{"reason"}
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 2501 | ▶ | return $Sisimai::Eb::ReSENT if substr($argvs->{'deliverystatus'}, 0, 2) eq '2.'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 2499 | my $reasontext = ''; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 2499 | ▶ | my $issuedcode = $argvs->{'diagnosticcode'} || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$argvs->{'diagnosticcode'} || ''
MC/DC100%1/1
$argvs->{'diagnosticcode'} || ''
$argvs->{'diagnosticcode'}
Truth table100%2/2
A
A= $argvs->{'diagnosticcode'}
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 2499 | ▶ | my $codeformat = $argvs->{'diagnostictype'} || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$argvs->{'diagnostictype'} || ''
MC/DC0%0/1
$argvs->{'diagnostictype'} || ''
$argvs->{'diagnostictype'}
Truth table50%1/2
A
A= $argvs->{'diagnostictype'}
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 2499 | ▶ | if( $codeformat eq 'SMTP' || $codeformat eq '' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$codeformat eq "SMTP" or $codeformat eq ""
MC/DC50%1/2
$codeformat eq "SMTP" or $codeformat eq ""
$codeformat eq "SMTP"
$codeformat eq ""
Truth table66%2/3
A or B
A= $codeformat eq "SMTP"B= $codeformat eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | # Diagnostic-Code: SMTP; ... or empty value | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 2428 | for my $e ( $ClassOrder->[0]->@* ) { | |||||||||||||||||||||||||||||||||||||||||
| 92 | # Check the values of Diagnostic-Code: and Status: fields using true() method of each | ||||||||||||||||||||||||||||||||||||||||||
| 93 | # child class in Sisimai::Reason | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 27423 | my $p = 'Sisimai::Reason::'.$e; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 27423 | require $ModulePath->{ $p }; | |||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 27423 | ▶ | next unless $p->true($argvs); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 1836 | $reasontext = $p->text; | |||||||||||||||||||||||||||||||||||||||||
| 99 | 1836 | last; | |||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 2499 | ▶ | if( not $reasontext || $reasontext eq $Sisimai::Eb::Re___0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$reasontext or $reasontext eq $Sisimai::Eb::Re___0
MC/DC50%1/2
$reasontext or $reasontext eq $Sisimai::Eb::Re___0
$reasontext
$reasontext eq $Sisimai::Eb::Re___0
Truth table66%2/3
A or B
A= $reasontextB= $reasontext eq $Sisimai::Eb::Re___0
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | # Bounce reason is not detected yet. | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 663 | $reasontext = __PACKAGE__->anotherone($argvs); | |||||||||||||||||||||||||||||||||||||||||
| 106 | 663 | ▶ | $reasontext = '' if $reasontext eq $Sisimai::Eb::Re___0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 663 | ▶ | $reasontext ||= $Sisiimai::Eb::ReTIME if $argvs->{'action'} eq $Sisimai::Eb::AeSTAY; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$reasontext ||= $Sisiimai::Eb::ReTIME
MC/DC0%0/2
$reasontext ||= $Sisiimai::Eb::ReTIME
$reasontext
$Sisiimai::Eb::ReTIME
Truth table33%1/3
A ||= B
A= $reasontextB= $Sisiimai::Eb::ReTIME
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 663 | ▶ | return $reasontext if $reasontext; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | # Try to match with message patterns in Sisimai::Reason::Vacation | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 42 | require Sisimai::Reason::Vacation; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 42 | ▶ | $reasontext = $Sisimai::Eb::ReAWAY if Sisimai::Reason::Vacation->match(lc $issuedcode); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 42 | ▶ | $reasontext ||= $Sisimai::Eb::Re___1 if $issuedcode; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$reasontext ||= $Sisimai::Eb::Re___1
MC/DC0%0/2
$reasontext ||= $Sisimai::Eb::Re___1
$reasontext
$Sisimai::Eb::Re___1
Truth table33%1/3
A ||= B
A= $reasontextB= $Sisimai::Eb::Re___1
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 42 | ▶ | $reasontext ||= $Sisimai::Eb::Re___0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$reasontext ||= $Sisimai::Eb::Re___0
MC/DC0%0/2
$reasontext ||= $Sisimai::Eb::Re___0
$reasontext
$Sisimai::Eb::Re___0
Truth table66%2/3
A ||= B
A= $reasontextB= $Sisimai::Eb::Re___0
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 1878 | return $reasontext; | |||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 664 | ▶ | sub anotherone { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
anotherone: called CC=28 SCAR=34.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | # Detect the other bounce reason, fall back method for find() | ||||||||||||||||||||||||||||||||||||||||||
| 121 | # @param [Hash] argvs Decoded email structure | ||||||||||||||||||||||||||||||||||||||||||
| 122 | # @return [String] Bounce reason or an empty string if the argument is missing or not HASH | ||||||||||||||||||||||||||||||||||||||||||
| 123 | # @see find() | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 664 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 125 | 664 | ▶ | my $argvs = shift // return ""; return $argvs->{'reason'} if $argvs->{'reason'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
shift() // (return "")
MC/DC100%1/1
shift() // (return "")
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 638 | require Sisimai::SMTP::Status; | |||||||||||||||||||||||||||||||||||||||||
| 128 | 638 | ▶ | my $issuedcode = lc $argvs->{'diagnosticcode'} // ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
lc $argvs->{"diagnosticcode"} // ""
MC/DC0%0/1
lc $argvs->{"diagnosticcode"} // ""
lc $argvs->{"diagnosticcode"}
Truth table50%1/2
A
A= lc $argvs->{"diagnosticcode"}
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 638 | ▶ | my $codeformat = $argvs->{'diagnostictype'} // ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$argvs->{"diagnostictype"} // ""
MC/DC0%0/1
$argvs->{"diagnostictype"} // ""
$argvs->{"diagnostictype"}
Truth table50%1/2
A
A= $argvs->{"diagnostictype"}
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 638 | ▶ | my $actiontext = $argvs->{'action'} // ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$argvs->{"action"} // ""
MC/DC0%0/1
$argvs->{"action"} // ""
$argvs->{"action"}
Truth table50%1/2
A
A= $argvs->{"action"}
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 638 | ▶ | my $statuscode = $argvs->{'deliverystatus'} // ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$argvs->{"deliverystatus"} // ""
MC/DC0%0/1
$argvs->{"deliverystatus"} // ""
$argvs->{"deliverystatus"}
Truth table50%1/2
A
A= $argvs->{"deliverystatus"}
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | 638 | ▶ | my $reasontext = Sisimai::SMTP::Status->name($statuscode) || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
'Sisimai::SMTP::Status'->name($statuscode) || ''
MC/DC100%1/1
'Sisimai::SMTP::Status'->name($statuscode) || ''
'Sisimai::SMTP::Status'->name($statuscode)
Truth table100%2/2
A
A= 'Sisimai::SMTP::Status'->name($statuscode)
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 638 | ▶ | my $trytomatch = $reasontext eq '' ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 638 | ▶ | $trytomatch = 1 if exists $GetRetried->{ $reasontext } || $codeformat ne 'SMTP'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $GetRetried->{$reasontext} or $codeformat ne "SMTP"
MC/DC100%2/2
exists $GetRetried->{$reasontext} or $codeformat ne "SMTP"
exists $GetRetried->{$reasontext}
$codeformat ne "SMTP"
Truth table100%3/3
A or B
A= exists $GetRetried->{$reasontext}B= $codeformat ne "SMTP"
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 638 | ▶ | while($trytomatch) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | # Could not decide the reason by the value of Status: | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 603 | for my $e ( $ClassOrder->[1]->@* ) { | |||||||||||||||||||||||||||||||||||||||||
| 139 | # Trying to match with other patterns in Sisimai::Reason::* classes | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 6222 | my $p = 'Sisimai::Reason::'.$e; | |||||||||||||||||||||||||||||||||||||||||
| 141 | 6222 | require $ModulePath->{ $p }; | |||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 6222 | ▶ | next unless $p->match($issuedcode); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 453 | $reasontext = $e; | |||||||||||||||||||||||||||||||||||||||||
| 145 | 453 | last; | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 603 | ▶ | last if $reasontext; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | # Check the value of Status: | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 83 | ▶ | my $code2digit = substr($statuscode, 0, 3) || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
substr($statuscode, 0, 3) || ''
MC/DC100%1/1
substr($statuscode, 0, 3) || ''
substr($statuscode, 0, 3)
Truth table100%2/2
A
A= substr($statuscode, 0, 3)
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 83 | ▶ | if( $code2digit eq '5.6' || $code2digit eq '4.6' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
$code2digit eq "5.6" or $code2digit eq "4.6"
MC/DC0%0/2
$code2digit eq "5.6" or $code2digit eq "4.6"
$code2digit eq "5.6"
$code2digit eq "4.6"
Truth table33%1/3
A or B
A= $code2digit eq "5.6"B= $code2digit eq "4.6"
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | # X.6.0 Other or undefined media error | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $reasontext = $Sisimai::Eb::ReBODY; | |||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | ▶ | } elsif( $code2digit eq '5.7' || $code2digit eq '4.7' ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$code2digit eq "5.7" or $code2digit eq "4.7"
MC/DC0%0/2
$code2digit eq "5.7" or $code2digit eq "4.7"
$code2digit eq "5.7"
$code2digit eq "4.7"
Truth table33%1/3
A or B
A= $code2digit eq "5.7"B= $code2digit eq "4.7"
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | # X.7.0 Other or undefined security status | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $reasontext = $Sisimai::Eb::ReSAFE; | |||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | } elsif( CORE::index($codeformat, 'X-UNIX') == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||
| 160 | # Diagnostic-Code: X-UNIX; ..., X-Postfix, or other X-* | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 15 | $reasontext = $Sisimai::Eb::ReUNIX; | |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 164 | # 50X Syntax Error? | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 68 | require Sisimai::Reason::SyntaxError; | |||||||||||||||||||||||||||||||||||||||||
| 166 | 68 | ▶ | $reasontext = $Sisimai::Eb::ReCOMM if Sisimai::Reason::SyntaxError->true($argvs); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 83 | ▶ | last if $reasontext; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | # Check the value of Action: field, first | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 68 | ▶ | if( CORE::index($actiontext, $Sisimai::Eb::AeSTAY) == 0 || CORE::index($actiontext, 'expired') == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
CORE::index($actiontext, $Sisimai::Eb::AeSTAY) == 0 or CORE::index($actiontext, "expired") == 0
MC/DC50%1/2
CORE::index($actiontext, $Sisimai::Eb::AeSTAY) == 0 or CORE::index($actiontext, "expired") == 0
CORE::index($actiontext, $Sisimai::Eb::AeSTAY) == 0
CORE::index($actiontext, "expired") == 0
Truth table66%2/3
A or B
A= CORE::index($actiontext, $Sisimai::Eb::AeSTAY) == 0B= CORE::index($actiontext, "expired") == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | # Action: delayed, expired | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 5 | $reasontext = $Sisimai::Eb::ReTIME; | |||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 176 | # Check the value of SMTP command | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 63 | ▶ | my $thecommand = $argvs->{'command'} // ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$argvs->{"command"} // ""
MC/DC0%0/1
$argvs->{"command"} // ""
$argvs->{"command"}
Truth table50%1/2
A
A= $argvs->{"command"}
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 63 | ▶ | if( $thecommand eq $Sisimai::Eb::CeEHLO || $thecommand eq $Sisimai::Eb::CeHELO ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$thecommand eq $Sisimai::Eb::CeEHLO or $thecommand eq $Sisimai::Eb::CeHELO
MC/DC100%2/2
$thecommand eq $Sisimai::Eb::CeEHLO or $thecommand eq $Sisimai::Eb::CeHELO
$thecommand eq $Sisimai::Eb::CeEHLO
$thecommand eq $Sisimai::Eb::CeHELO
Truth table100%3/3
A or B
A= $thecommand eq $Sisimai::Eb::CeEHLOB= $thecommand eq $Sisimai::Eb::CeHELO
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | # Rejected at connection or after EHLO|HELO | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 21 | $reasontext = $Sisimai::Eb::ReBLOC; | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 68 | last; | |||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 638 | return $reasontext; | |||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 189 | ▶ | sub match { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
match: called CC=8 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | # Detect the bounce reason from given text | ||||||||||||||||||||||||||||||||||||||||||
| 190 | # @param [String] argv1 Error message | ||||||||||||||||||||||||||||||||||||||||||
| 191 | # @return [String] Bounce reason | ||||||||||||||||||||||||||||||||||||||||||
| 192 | 189 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 189 | ▶ | my $argv1 = shift // return ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() // (return "")
MC/DC100%1/1
shift() // (return "")
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 188 | my $reasontext = ''; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 188 | my $issuedcode = lc $argv1; | |||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | # Diagnostic-Code: SMTP; ... or empty value | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 188 | for my $e ( $ClassOrder->[2]->@* ) { | |||||||||||||||||||||||||||||||||||||||||
| 200 | # Check the values of Diagnostic-Code: and Status: fields using true() method of each child | ||||||||||||||||||||||||||||||||||||||||||
| 201 | # class in Sisimai::Reason | ||||||||||||||||||||||||||||||||||||||||||
| 202 | 2149 | my $p = 'Sisimai::Reason::'.$e; | |||||||||||||||||||||||||||||||||||||||||
| 203 | 2149 | require $ModulePath->{ $p }; | |||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 2149 | ▶ | next unless $p->match($issuedcode); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 144 | $reasontext = $p->text; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 144 | last; | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 188 | ▶ | return $reasontext if $reasontext; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 44 | ▶ | if( CORE::index(uc $issuedcode, 'X-UNIX; ') > -1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | # X-Unix; ... | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $reasontext = $Sisimai::Eb::ReUNIX; | |||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 216 | # Detect the bounce reason from "Status:" code | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 44 | require Sisimai::SMTP::Status; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 44 | ▶ | my $cv = Sisimai::SMTP::Status->find($argv1) || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
'Sisimai::SMTP::Status'->find($argv1) || ''
MC/DC100%1/1
'Sisimai::SMTP::Status'->find($argv1) || ''
'Sisimai::SMTP::Status'->find($argv1)
Truth table100%2/2
A
A= 'Sisimai::SMTP::Status'->find($argv1)
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 44 | ▶ | $reasontext = Sisimai::SMTP::Status->name($cv) || $Sisimai::Eb::Re___0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
'Sisimai::SMTP::Status'->name($cv) || $Sisimai::Eb::Re___0
MC/DC0%0/2
'Sisimai::SMTP::Status'->name($cv) || $Sisimai::Eb::Re___0
'Sisimai::SMTP::Status'->name($cv)
$Sisimai::Eb::Re___0
Truth table66%2/3
A || B
A= 'Sisimai::SMTP::Status'->name($cv)B= $Sisimai::Eb::Re___0
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 44 | return $reasontext; | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | 87 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 225 | __END__ | ||||||||||||||||||||||||||||||||||||||||||