File Coverage

lib/Sisimai/Reason/NetworkError.pm
Criterion Covered Total %
statement 18 18 100.0
branch 2 2 100.0
condition 1 2 50.0
subroutine 7 7 100.0
pod 2 4 50.0
total 30 33 90.9


line stmt bran cond sub pod time code
1             package Sisimai::Reason::NetworkError;
2 25     25   1486 use feature ':5.10';
  25         45  
  25         1678  
3 25     25   142 use strict;
  25         43  
  25         425  
4 25     25   108 use warnings;
  25         37  
  25         4016  
5              
6 3     3 1 9 sub text { 'networkerror' }
7 4     4 0 18 sub description { 'SMTP connection failed due to DNS look up failure or other network problems' }
8             sub match {
9             # Try to match that the given text and regular expressions
10             # @param [String] argv1 String to be matched with regular expressions
11             # @return [Integer] 0: Did not match
12             # 1: Matched
13             # @since v4.1.12
14 391     391 1 687 my $class = shift;
15 391   50     1033 my $argv1 = shift // return undef;
16              
17 391         695 state $index = [
18             'could not connect and send the mail to',
19             'dns records for the destination computer could not be found',
20             'hop count exceeded - possible mail loop',
21             'host is unreachable',
22             'host name lookup failure',
23             'host not found, try again',
24             'mail forwarding loop for ',
25             'malformed name server reply',
26             'malformed or unexpected name server reply',
27             'maximum forwarding loop count exceeded',
28             'message looping',
29             'message probably in a routing loop',
30             'no route to host',
31             'too many hops',
32             'unable to resolve route ',
33             'unrouteable mail domain',
34             ];
35 391 100       754 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  6256         9651  
36 347         983 return 0;
37             }
38              
39             sub true {
40             # The bounce reason is network error or not
41             # @param [Sisimai::Data] argvs Object to be detected the reason
42             # @return [Integer] 1: is network error
43             # 0: is not network error
44             # @see http://www.ietf.org/rfc/rfc2822.txt
45 2     2 0 7 return undef;
46             }
47              
48             1;
49             __END__