File Coverage

lib/Sisimai/Rhost/Aol.pm
Criterion Covered Total %
statement 20 20 100.0
branch 4 4 100.0
condition 2 2 100.0
subroutine 4 4 100.0
pod 0 1 0.0
total 30 31 96.7


line stmt bran cond sub pod time code
1             package Sisimai::Rhost::Aol;
2 5     5   2127 use v5.26;
  5         12  
3 5     5   18 use strict;
  5         6  
  5         141  
4 5     5   16 use warnings;
  5         10  
  5         877  
5              
6             sub find {
7             # Detect bounce reason for Aol Mail: https://www.aol.com
8             # @param [Sisimai::Fact] argvs Decoded email object
9             # @return [String] Detected bounce reason
10             # @see
11             # - Y!Sender Hub/SMTP Error Codes: https://senders.yahooinc.com/smtp-error-codes/
12             # - The MX record of Aol points "mx-aol.mail.gm0.yahoodns.net".
13             # @since v5.2.0
14 47     47 0 1149 my $class = shift;
15 47 100 100     98 my $argvs = shift // return ""; return "" unless $argvs->{'diagnosticcode'};
  46         115  
16              
17 45         60 state $messagesof = {
18             "hostunknown" => ["Host or domain name not found"],
19             "notaccept" => ["type=MX: Malformed or unexpected name server reply"],
20             };
21              
22 45         65 my $issuedcode = $argvs->{'diagnosticcode'};
23 45         45 my $reasontext = '';
24              
25 45         98 for my $e ( keys %$messagesof ) {
26             # Try to find the error message matches with the given error message string
27 83 100       100 next unless grep { index($issuedcode, $_) > -1 } $messagesof->{ $e }->@*;
  83         189  
28 19         48 $reasontext = $e;
29 19         21 last;
30             }
31 45         150 return $reasontext;
32             }
33              
34             1;
35             __END__