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   1265 use feature ':5.10';
  11         21  
  11         932  
3 11     11   57 use strict;
  11         15  
  11         212  
4 11     11   44 use warnings;
  11         17  
  11         1826  
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 919 my $class = shift;
11 93   100     254 my $argvs = shift // return undef;
12              
13 92         141 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         280 my $statusmesg = $argvs->diagnosticcode;
18 92         416 my $reasontext = '';
19              
20 92         311 for my $e ( keys %$messagesof ) {
21             # Try to match the error message with message patterns defined in $MessagesOf
22 135 100       396 next unless rindex($statusmesg, $messagesof->{ $e }) > -1;
23 87         124 $reasontext = $e;
24 87         102 last;
25             }
26 92         240 return $reasontext;
27             }
28              
29             1;
30             __END__