File Coverage

lib/Sisimai/Reason/MailerError.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition 2 2 100.0
subroutine 7 7 100.0
pod 2 4 50.0
total 30 32 93.7


line stmt bran cond sub pod time code
1             package Sisimai::Reason::MailerError;
2 21     21   2752 use v5.26;
  21         72  
3 21     21   149 use strict;
  21         42  
  21         557  
4 21     21   94 use warnings;
  21         37  
  21         5218  
5              
6 10     10 1 38 sub text { 'mailererror' }
7 4     4 0 13 sub description { 'Email returned due to a mailer program has not exited successfully' }
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.0.0
14 241     241 1 1133 my $class = shift;
15 241   100     848 my $argv1 = shift // return 0;
16              
17 240         567 state $index = [
18             ' || exit ',
19             'procmail: ',
20             'bin/procmail',
21             'bin/maidrop',
22             'command failed: ',
23             'command died with status ',
24             'command output:',
25             'mailer error',
26             'pipe to |/',
27             'x-unix; ',
28             ];
29 240 100       497 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  2400         4432  
30 220         791 return 0;
31             }
32              
33             sub true {
34             # The bounce reason is mailer error or not
35             # @param [Sisimai::Fact] argvs Object to be detected the reason
36             # @return [Integer] 1: is mailer error
37             # 0: is not mailer error
38             # @see http://www.ietf.org/rfc/rfc2822.txt
39 2     2 0 5 return 0;
40             }
41              
42             1;
43             __END__