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   7309 use v5.26;
  5         20  
3 5     5   31 use strict;
  5         12  
  5         197  
4 5     5   30 use warnings;
  5         7  
  5         1367  
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 686 my $class = shift;
15 47 100 100     145 my $argvs = shift // return ""; return "" unless $argvs->{'diagnosticcode'};
  46         183  
16              
17 45         84 state $messagesof = {
18             "hostunknown" => ["Host or domain name not found"],
19             "notaccept" => ["type=MX: Malformed or unexpected name server reply"],
20             };
21              
22 45         103 my $issuedcode = $argvs->{'diagnosticcode'};
23 45         77 my $reasontext = '';
24              
25 45         148 for my $e ( keys %$messagesof ) {
26             # Try to find the error message matches with the given error message string
27 83 100       179 next unless grep { index($issuedcode, $_) > -1 } $messagesof->{ $e }->@*;
  83         277  
28 19         30 $reasontext = $e;
29 19         34 last;
30             }
31 45         167 return $reasontext;
32             }
33              
34             1;
35             __END__