File Coverage

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


line stmt bran cond sub pod time code
1             package Sisimai::Rhost::KDDI;
2 11     11   1562 use feature ':5.10';
  11         23  
  11         1294  
3 11     11   65 use strict;
  11         19  
  11         231  
4 11     11   49 use warnings;
  11         17  
  11         2011  
5              
6             sub get {
7             # Detect bounce reason from au(KDDI)
8             # @param [Sisimai::Data] argvs Parsed email object
9             # @return [String] The bounce reason au.com and ezweb.ne.jp
10 93     93 0 1827 my $class = shift;
11 93   100     313 my $argvs = shift // return undef;
12              
13 92         163 state $messagesof = {
14             'filtered' => '550 : User unknown', # The response was: 550 : User unknown
15             'userunknown' => '>: User unknown', # The response was: 550 <...>: User unknown
16             };
17 92         289 my $statusmesg = $argvs->diagnosticcode;
18 92         548 my $reasontext = '';
19              
20 92         335 for my $e ( keys %$messagesof ) {
21             # Try to match the error message with message patterns defined in $MessagesOf
22 133 100       421 next unless rindex($statusmesg, $messagesof->{ $e }) > -1;
23 87         171 $reasontext = $e;
24 87         188 last;
25             }
26 92         327 return $reasontext;
27             }
28              
29             1;
30             __END__