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 22     22   1662 use feature ':5.10';
  22         36  
  22         1347  
3 22     22   112 use strict;
  22         37  
  22         351  
4 22     22   86 use warnings;
  22         42  
  22         3130  
5              
6 3     3 1 20 sub text { 'networkerror' }
7 4     4 0 13 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 331     331 1 547 my $class = shift;
15 331   50     934 my $argv1 = shift // return undef;
16              
17 331         523 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 not found, try again',
23             'mail forwarding loop for ',
24             'malformed name server reply',
25             'malformed or unexpected name server reply',
26             'maximum forwarding loop count exceeded',
27             'message looping',
28             'message probably in a routing loop',
29             'no route to host',
30             'too many hops',
31             'unable to resolve route ',
32             'unrouteable mail domain',
33             ];
34 331 100       604 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  4965         6651  
35 292         718 return 0;
36             }
37              
38             sub true {
39             # The bounce reason is network error or not
40             # @param [Sisimai::Data] argvs Object to be detected the reason
41             # @return [Integer] 1: is network error
42             # 0: is not network error
43             # @see http://www.ietf.org/rfc/rfc2822.txt
44 2     2 0 4 return undef;
45             }
46              
47             1;
48             __END__