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 34     34   2545 use v5.26;
  34         105  
3 34     34   123 use strict;
  34         62  
  34         662  
4 34     34   122 use warnings;
  34         47  
  34         6025  
5              
6 10     10 1 34 sub text { 'mailererror' }
7 4     4 0 19 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 452     452 1 1465 my $class = shift;
15 452   100     1003 my $argv1 = shift // return 0;
16              
17 451         562 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 451 100       669 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  4510         6243  
30 421         781 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 9 return 0;
40             }
41              
42             1;
43             __END__