1Mail::SPF::Mod(3) User Contributed Perl Documentation Mail::SPF::Mod(3)
2
3
4
6 Mail::SPF::Mod - SPF record modifier base class
7
9 An object of class Mail::SPF::Mod represents a modifier within an SPF
10 record. Mail::SPF::Mod cannot be instantiated directly. Create an
11 instance of a concrete sub-class instead.
12
13 Constructors
14 The following constructors are provided:
15
16 new(%options): returns Mail::SPF::Mod
17 Abstract. Creates a new SPF record modifier object.
18
19 %options is a list of key/value pairs representing any of the
20 following options:
21
22 text
23 A string denoting the unparsed text of the modifier.
24
25 name
26 A string denoting the name of the modifier. Required if a
27 generic Mail::SPF::Mod object (as opposed to a specific sub-
28 class) is being constructed.
29
30 domain_spec
31 Either a plain string or a Mail::SPF::MacroString object
32 denoting an optional "domain-spec" parameter of the mechanism.
33
34 new_from_string($text, %options): returns Mail::SPF::Mod; throws
35 Mail::SPF::ENothingToParse, Mail::SPF::EInvalidMod
36 Abstract. Creates a new SPF record modifier object by parsing the
37 string and any options given.
38
39 Class methods
40 The following class methods are provided:
41
42 name_pattern: returns Regexp
43 Returns a regular expression that matches any legal modifier name.
44
45 Instance methods
46 The following instance methods are provided:
47
48 text: returns string; throws Mail::SPF::ENoUnparsedText
49 Returns the unparsed text of the modifier. Throws a
50 Mail::SPF::ENoUnparsedText exception if the modifier was created
51 synthetically instead of being parsed, and no text was provided.
52
53 name: returns string
54 Returns the name of the modifier.
55
56 params: returns string
57 Abstract. Returns the modifier's parameters formatted as a string.
58
59 A sub-class of Mail::SPF::Mod does not have to implement this
60 method if it supports no parameters, although this is highly
61 unlikely.
62
63 stringify: returns string
64 Formats the modifier's name and parameters as a string and returns
65 it. You can simply use a Mail::SPF::Mod object as a string for the
66 same effect, see "OVERLOADING".
67
68 process: throws Mail::SPF::Result, Mail::SPF::Result::Error,
69 Mail::SPF::Exception
70 Abstract. Processes the modifier. What that means depends on the
71 actual implementation in sub-classes. See "MODIFIER TYPES" below.
72
73 This method is abstract and must be implemented by sub-classes of
74 Mail::SPF::Mod.
75
77 There are different basic types of modifiers, which are described
78 below. All of them are provided by the Mail::SPF::Mod module.
79
80 Global modifiers - Mail::SPF::GlobalMod
81 SPFv1 (RFC 4408) only knows "global" modifiers. A global modifier may
82 appear anywhere in an SPF record, but only once. During evaluation of
83 the record, global modifiers are processed after the last mechanism has
84 been evaluated and an SPF result has been determined.
85
86 The following additional class method is provided by
87 Mail::SPF::GlobalMod:
88
89 precedence: returns real
90 Abstract. Returns a real number between 0 and 1 denoting the
91 precedence of the type of the global modifier. Global modifiers
92 present in an SPF record are processed in the order of their
93 precedence values, 0 meaning "first".
94
95 This method is abstract and must be implemented by sub-classes of
96 Mail::SPF::GlobalMod.
97
98 The following specific instance method is provided by
99 Mail::SPF::GlobalMod:
100
101 process($server, $request, $result): throws Mail::SPF::Result
102 Abstract. Processes the modifier. What that means depends on the
103 actual implementation in sub-classes. Takes both a
104 Mail::SPF::Server and a Mail::SPF::Request object. As global
105 modifiers are generally processed after an SPF result has already
106 been determined, takes also the current Mail::SPF::Result. If the
107 modifier wishes to modify the SPF result, it may throw a different
108 Mail::SPF::Result object.
109
110 This method is abstract and must be implemented by sub-classes of
111 Mail::SPF::GlobalMod.
112
113 Positional modifiers - Mail::SPF::PositionalMod
114 Sender ID (RFC 4406) introduces the concept of "positional" modifiers.
115 According to RFC 4406, a positional modifier must follow a mechanism
116 and applies to that, and only that, mechanism. However, because this
117 definition is not very useful, and because no positional modifiers have
118 been defined based on it as of yet, Mail::SPF deviates from RFC 4406 as
119 follows:
120
121 A positional modifier may appear anywhere in an SPF record, and it is
122 stateful, i.e. it applies to all mechanisms and modifiers that follow
123 it. Positional modifiers are generally multiple, i.e. they may appear
124 any number of times throughout the record. During evaluation of the
125 record, positional modifiers are processed at exactly the time when
126 they are encountered by the evaluator. Consequently, all positional
127 modifiers are processed before an SPF result is determined.
128
129 The following specific instance method is provided by
130 Mail::SPF::PositionalMod:
131
132 process($server, $request): throws Mail::SPF::Result::Error,
133 Mail::SPF::Exception
134 Abstract. Processes the modifier. What that means depends on the
135 actual implementation in sub-classes. Takes both a
136 Mail::SPF::Server and a Mail::SPF::Request object. As global
137 modifiers are generally processed before an SPF result has been
138 determined, no result object is available to the modifier. The
139 modifier can (at least at this time) not directly modify the final
140 SPF result, however it may throw an exception to signal an error
141 condition.
142
143 This method is abstract and must be implemented by sub-classes of
144 Mail::SPF::PositionalMod.
145
146 Unknown modifiers - Mail::SPF::UnknownMod
147 Both SPFv1 and Sender ID allow unknown modifiers to appear in SPF
148 records in order to allow new modifiers to be introduced without
149 breaking existing implementations. Obviously, unknown modifiers are
150 neither global nor positional, but they may appear any number of times
151 throughout the record and are simply ignored during evaluation of the
152 record.
153
154 Also obviously, Mail::SPF::UnknownMod does not support a "process"
155 method.
156
157 The following specific instance method is provided by
158 Mail::SPF::UnknownMod:
159
160 params: returns string
161 Returns the modifier's unparsed value as a string.
162
164 If a Mail::SPF::Mod object is used as a string, the "stringify" method
165 is used to convert the object into a string.
166
168 Mail::SPF::Mod::Redirect, Mail::SPF::Mod::Exp
169
170 Mail::SPF, Mail::SPF::Record, Mail::SPF::Term
171
172 <http://tools.ietf.org/html/rfc4408>
173
174 For availability, support, and license information, see the README file
175 included with Mail::SPF.
176
178 Julian Mehnle <julian@mehnle.net>, Shevek <cpan@anarres.org>
179
180
181
182perl v5.30.1 2020-01-30 Mail::SPF::Mod(3)