File Coverage

lib/Sisimai/Rhost/KDDI.pm
Criterion Covered Total %
statement 19 19 100.0
branch 4 4 100.0
condition 2 2 100.0
subroutine 4 4 100.0
pod 0 1 0.0
total 29 30 96.6


line stmt bran cond sub pod time code
1             package Sisimai::Rhost::KDDI;
2 15     15   2060 use v5.26;
  15         59  
3 15     15   87 use strict;
  15         27  
  15         504  
4 15     15   104 use warnings;
  15         35  
  15         3986  
5              
6             sub find {
7             # Detect bounce reason from au(KDDI)
8             # @param [Sisimai::Fact] argvs Decoded email object
9             # @return [String] The bounce reason au.com and ezweb.ne.jp
10             # @since v4.22.6
11 139     139 0 1377 my $class = shift;
12 139 100 100     546 my $argvs = shift // return ""; return "" unless $argvs->{'diagnosticcode'};
  138         690  
13              
14 137         305 state $messagesof = {
15             'filtered' => '550 : user unknown', # The response was: 550 : User unknown
16             'userunknown' => '>: user unknown', # The response was: 550 <...>: User unknown
17             };
18 137         478 my $issuedcode = lc $argvs->{'diagnosticcode'};
19 137         230 my $reasontext = '';
20              
21 137         510 for my $e ( keys %$messagesof ) {
22             # Try to match the error message with message patterns defined in $MessagesOf
23 203 100       705 next unless rindex($issuedcode, $messagesof->{ $e }) > -1;
24 120         236 $reasontext = $e;
25 120         333 last;
26             }
27 137         575 return $reasontext;
28             }
29              
30             1;
31             __END__