1Mail::SPF::Record(3)  User Contributed Perl Documentation Mail::SPF::Record(3)
2
3
4

NAME

6       Mail::SPF::Record - Abstract base class for SPF records
7

SYNOPSIS

9   Creating a record from a string
10           use Mail::SPF::v1::Record;
11
12           my $record = Mail::SPF::v1::Record->new_from_string("v=spf1 a mx -all");
13
14   Creating a record synthetically
15           use Mail::SPF::v2::Record;
16
17           my $record = Mail::SPF::v2::Record->new(
18               scopes      => ['mfrom', 'pra'],
19               terms       => [
20                   Mail::SPF::Mech::A->new(),
21                   Mail::SPF::Mech::MX->new(),
22                   Mail::SPF::Mech::All->new(qualifier => '-')
23               ],
24               global_mods => [
25                   Mail::SPF::Mod::Exp->new(domain_spec => 'spf-exp.example.com')
26               ]
27           );
28

DESCRIPTION

30       Mail::SPF::Record is an abstract base class for SPF records.  It cannot
31       be instantiated directly.  Create an instance of a concrete sub-class
32       instead.
33
34   Constructor
35       The following constructors are provided:
36
37       new(%options): returns Mail::SPF::Record
38           Creates a new SPF record object.
39
40           %options is a list of key/value pairs representing any of the
41           following options:
42
43           text
44               A string denoting the unparsed text of the record.
45
46           scopes
47               A reference to an array of strings denoting the scopes that are
48               covered by the record (see the description of the "scope"
49               option of Mail::SPF::Request's "new" constructor).
50
51           terms
52               A reference to an array of Mail::SPF::Term (i.e.
53               Mail::SPF::Mech or Mail::SPF::Mod) objects that make up the
54               record.  Mail::SPF::GlobalMod objects must not be included
55               here, but should be specified using the "global_mods" option
56               instead.
57
58           global_mods
59               A reference to an array of Mail::SPF::GlobalMod objects that
60               are global modifiers of the record.
61
62       new_from_string($text, %options): returns Mail::SPF::Record; throws
63       Mail::SPF::ENothingToParse, Mail::SPF::EInvalidRecordVersion,
64       Mail::SPF::ESyntaxError
65           Creates a new SPF record object by parsing the string and any
66           options given.
67
68   Class methods
69       The following class methods are provided:
70
71       version_tag_pattern: returns Regexp
72           Abstract.  Returns a regular expression that matches a legal
73           version tag.
74
75           This method is abstract and must be implemented by sub-classes of
76           Mail::SPF::Record.
77
78       default_qualifier: returns string
79           Returns the default qualifier, i.e. '+'.
80
81       results_by_qualifier: returns hash of string
82           Returns a reference to a hash that maps qualifiers to result codes
83           as follows:
84
85                Qualifier | Result code
86               -----------+-------------
87                    +     | pass
88                    -     | fail
89                    ~     | softfail
90                    ?     | neutral
91
92   Instance methods
93       The following instance methods are provided:
94
95       text: returns string; throws Mail::SPF::ENoUnparsedText
96           Returns the unparsed text of the record.  Throws a
97           Mail::SPF::ENoUnparsedText exception if the record was created
98           synthetically instead of being parsed, and no text was provided.
99
100       version_tag: returns string
101           Abstract.  Returns the version tag of the record.
102
103           This method is abstract and must be implemented by sub-classes of
104           Mail::SPF::Record.
105
106       scopes: returns list of string
107           Returns a list of the scopes that are covered by the record.  See
108           the description of the "new" constructor's "scopes" option.
109
110       terms: returns list of Mail::SPF::Term
111           Returns a list of the terms that make up the record, excluding any
112           global modifiers, which are returned by the "global_mods" method.
113           See the description of the "new" constructor's "terms" option.
114
115       global_mods: returns list of Mail::SPF::GlobalMod
116           Returns a list of the global modifiers of the record, ordered
117           ascending by modifier precedence.  See the description of the "new"
118           constructor's "global_mods" option.
119
120       global_mod($mod_name): returns Mail::SPF::GlobalMod
121           Returns the global modifier of the given name if it is present in
122           the record.  Returns undef otherwise.  Use this method if you wish
123           to retrieve a specific global modifier as opposed to getting all of
124           them.
125
126       stringify: returns string
127           Returns the record's version tag and terms (including the global
128           modifiers) formatted as a string.  You can simply use a
129           Mail::SPF::Record object as a string for the same effect, see
130           "OVERLOADING".
131
132       eval($server, $request): throws Mail::SPF::Result
133           Evaluates the SPF record in the context of the request parameters
134           represented by the given Mail::SPF::Request object.  The given
135           Mail::SPF::Server object is used for performing DNS look-ups.
136           Throws a Mail::SPF::Result object matching the outcome of the
137           evaluation; see Mail::SPF::Result.  See RFC 4408, 4.6 and 4.7, for
138           the exact algorithm used.
139

OVERLOADING

141       If a Mail::SPF::Record object is used as a string, the "stringify"
142       method is used to convert the object into a string.
143

SEE ALSO

145       Mail::SPF, Mail::SPF::v1::Record, Mail::SPF::v2::Record,
146       Mail::SPF::Term, Mail::SPF::Mech, Mail::SPF::Mod
147
148       <http://tools.ietf.org/html/rfc4408>
149
150       For availability, support, and license information, see the README file
151       included with Mail::SPF.
152

AUTHORS

154       Julian Mehnle <julian@mehnle.net>, Shevek <cpan@anarres.org>
155
156
157
158perl v5.32.0                      2020-07-28              Mail::SPF::Record(3)
Impressum