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   2075 use feature ':5.10';
  25         49  
  25         1746  
3 25     25   155 use strict;
  25         63  
  25         463  
4 25     25   105 use warnings;
  25         39  
  25         4259  
5              
6 3     3 1 27 sub text { 'networkerror' }
7 4     4 0 15 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 690 my $class = shift;
15 391   50     946 my $argv1 = shift // return undef;
16              
17 391         629 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       740 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  6256         9932  
36 347         1017 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 6 return undef;
46             }
47              
48             1;
49             __END__