File Coverage

blib/lib/Mail/SPF.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1             #
2             # Mail::SPF
3             # An object-oriented Perl implementation of Sender Policy Framework.
4             #
5             #
6             # (C) 2005-2012 Julian Mehnle
7             # 2005 Shevek
8             # $Id: SPF.pm 63 2013-07-22 03:52:21Z julian $
9             #
10             ##############################################################################
11              
12             package Mail::SPF;
13              
14             =head1 NAME
15              
16             Mail::SPF - An object-oriented implementation of Sender Policy Framework
17              
18             =head1 VERSION
19              
20             version 3.20250505
21              
22             =cut
23              
24             our $VERSION = '3.20250505'; # VERSION
25              
26 1     1   1586 use warnings;
  1         2  
  1         92  
27 1     1   9 use strict;
  1         4  
  1         29  
28              
29 1     1   620 use Mail::SPF::Server;
  1         11  
  1         100  
30 1     1   645 use Mail::SPF::Request;
  1         3  
  1         35  
31              
32 1     1   6 use constant TRUE => (0 == 0);
  1         3  
  1         51  
33 1     1   4 use constant FALSE => not TRUE;
  1         2  
  1         66  
34              
35             =head1 SYNOPSIS
36              
37             use Mail::SPF;
38              
39             my $spf_server = Mail::SPF::Server->new();
40              
41             my $request = Mail::SPF::Request->new(
42             versions => [1, 2], # optional
43             scope => 'mfrom', # or 'helo', 'pra'
44             identity => 'fred@example.com',
45             ip_address => '192.168.0.1',
46             helo_identity => 'mta.example.com' # optional,
47             # for %{h} macro expansion
48             );
49              
50             my $result = $spf_server->process($request);
51              
52             print("$result\n");
53             my $result_code = $result->code; # 'pass', 'fail', etc.
54             my $local_exp = $result->local_explanation;
55             my $authority_exp = $result->authority_explanation
56             if $result->is_code('fail');
57             my $spf_header = $result->received_spf_header;
58              
59             =head1 DESCRIPTION
60              
61             B is an object-oriented implementation of Sender Policy Framework
62             (SPF). See L for more information about
63             SPF.
64              
65             This class collection aims to fully conform to the SPF specification (RFC
66             4408) so as to serve both as a production quality SPF implementation and as a
67             reference for other developers of SPF implementations.
68              
69             =head1 SEE ALSO
70              
71             L, L, L
72              
73             For availability, support, and license information, see the README file
74             included with Mail::SPF.
75              
76             =head1 REFERENCES
77              
78             =over
79              
80             =item The SPF project
81              
82             L
83              
84             =item The SPFv1 specification (RFC 7208)
85              
86             L, L
87              
88             =back
89              
90             =head1 AUTHORS
91              
92             Julian Mehnle , Shevek
93              
94             =cut
95              
96             TRUE;