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   1502 use v5.26;
  15         46  
3 15     15   65 use strict;
  15         23  
  15         391  
4 15     15   65 use warnings;
  15         27  
  15         3154  
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 1169 my $class = shift;
12 139 100 100     364 my $argvs = shift // return ""; return "" unless $argvs->{'diagnosticcode'};
  138         424  
13              
14 137         216 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         327 my $issuedcode = lc $argvs->{'diagnosticcode'};
19 137         603 my $reasontext = '';
20              
21 137         388 for my $e ( keys %$messagesof ) {
22             # Try to match the error message with message patterns defined in $MessagesOf
23 224 100       612 next unless rindex($issuedcode, $messagesof->{ $e }) > -1;
24 120         159 $reasontext = $e;
25 120         165 last;
26             }
27 137         377 return $reasontext;
28             }
29              
30             1;
31             __END__