File Coverage

lib/Sisimai/Reason/SyntaxError.pm
Criterion Covered Total %
statement 19 19 100.0
branch 5 8 62.5
condition 9 10 90.0
subroutine 7 7 100.0
pod 2 4 50.0
total 42 48 87.5


line stmt bran cond sub pod time code
1             package Sisimai::Reason::SyntaxError;
2 15     15   2088 use v5.26;
  15         61  
3 15     15   112 use strict;
  15         36  
  15         727  
4 15     15   103 use warnings;
  15         28  
  15         3637  
5              
6 1     1 1 18 sub text { 'syntaxerror' }
7 4     4 0 14 sub description { 'Email rejected due to syntax error at sent commands in SMTP session' }
8 45     45 1 104 sub match { return 0 }
9             sub true {
10             # Connection rejected due to syntax error or not
11             # @param [Sisimai::Fact] argvs Object to be detected the reason
12             # @return [Integer] 1: Rejected due to syntax error
13             # 0: is not syntax error
14             # @since v4.1.25
15             # @see http://www.ietf.org/rfc/rfc2822.txt
16 74     74 0 165 my $class = shift;
17 74 50 100     271 my $argvs = shift // return 0; return 0 unless exists $argvs->{'replycode'};
  73         376  
18 73   100     399 my $reply = int($argvs->{'replycode'} || 0);
19              
20 73 50       295 return 1 if $argvs->{'reason'} eq 'syntaxerror';
21 73 50 66     489 return 1 if $reply > 400 && $reply < 408;
22 73 100 100     363 return 1 if $reply > 500 && $reply < 508;
23 68         255 return 0;
24             }
25              
26             1;
27             __END__