File Coverage

lib/Sisimai/Reason/SystemError.pm
Criterion Covered Total %
statement 23 23 100.0
branch 4 4 100.0
condition 2 2 100.0
subroutine 8 8 100.0
pod 2 4 50.0
total 39 41 95.1


line stmt bran cond sub pod time code
1             package Sisimai::Reason::SystemError;
2 32     32   3809 use v5.26;
  32         120  
3 32     32   165 use strict;
  32         61  
  32         823  
4 32     32   162 use warnings;
  32         2179  
  32         1616  
5 32     32   491 use Sisimai::String;
  32         88  
  32         9912  
6              
7 5     5 1 28 sub text { 'systemerror' }
8 4     4 0 20 sub description { 'Email returned due to system error on the remote host' }
9             sub match {
10             # Try to match that the given text and regular expressions
11             # @param [String] argv1 String to be matched with regular expressions
12             # @return [Integer] 0: Did not match
13             # 1: Matched
14             # @since v4.0.0
15 450     450 1 1653 my $class = shift;
16 450   100     1560 my $argv1 = shift // return 0;
17              
18 449         875 state $index = [
19             "aliasing/forwarding loop broken",
20             "can't create user output file",
21             "cannot send e-mail to yourself",
22             "could not load ",
23             "interrupted system call",
24             "it encountered an error while being processed",
25             "it would create a mail loop",
26             "loop was found in the mail exchanger",
27             "loops back to myself",
28             "queue file write error",
29             "recipient deferred because there is no mdb",
30             "remote server is misconfigured",
31             "service currently unavailable",
32             "temporary local problem",
33             "timeout waiting for input",
34             "transaction failed ",
35             ];
36 449         817 state $pairs = [
37             ["config", " error"],
38             ["internal ", "error"],
39             ["local ", "error"],
40             ["unable to connect ", "daemon"],
41             ];
42 449 100       1080 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  7184         17730  
43 415 100       898 return 1 if grep { Sisimai::String->aligned(\$argv1, $_) } @$pairs;
  1660         3931  
44 404         1330 return 0;
45             }
46              
47             sub true {
48             # The bounce reason is system error or not
49             # @param [Sisimai::Fact] argvs Object to be detected the reason
50             # @return [Integer] 1: is system error
51             # 0: is not system error
52             # @see http://www.ietf.org/rfc/rfc2822.txt
53 2     2 0 7 return 0;
54             }
55              
56             1;
57             __END__