.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mail::SPF::Mod 3pm" .TH Mail::SPF::Mod 3pm 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Mail::SPF::Mod \- SPF record modifier base class .SH DESCRIPTION .IX Header "DESCRIPTION" An object of class \fBMail::SPF::Mod\fR represents a modifier within an SPF record. Mail::SPF::Mod cannot be instantiated directly. Create an instance of a concrete sub-class instead. .SS Constructors .IX Subsection "Constructors" The following constructors are provided: .IP "\fBnew(%options)\fR: returns \fIMail::SPF::Mod\fR" 4 .IX Item "new(%options): returns Mail::SPF::Mod" \&\fIAbstract\fR. Creates a new SPF record modifier object. .Sp \&\f(CW%options\fR is a list of key/value pairs representing any of the following options: .RS 4 .IP \fBtext\fR 4 .IX Item "text" A \fIstring\fR denoting the unparsed text of the modifier. .IP \fBname\fR 4 .IX Item "name" A \fIstring\fR denoting the name of the modifier. \fIRequired\fR if a generic \&\fIMail::SPF::Mod\fR object (as opposed to a specific sub-class) is being constructed. .IP \fBdomain_spec\fR 4 .IX Item "domain_spec" Either a plain \fIstring\fR or a \fIMail::SPF::MacroString\fR object denoting an optional \f(CW\*(C`domain\-spec\*(C'\fR parameter of the mechanism. .RE .RS 4 .RE .ie n .IP "\fBnew_from_string($text, \fR\fB%options\fR\fB)\fR: returns \fIMail::SPF::Mod\fR; throws \fIMail::SPF::ENothingToParse\fR, \fIMail::SPF::EInvalidMod\fR" 4 .el .IP "\fBnew_from_string($text, \fR\f(CB%options\fR\fB)\fR: returns \fIMail::SPF::Mod\fR; throws \fIMail::SPF::ENothingToParse\fR, \fIMail::SPF::EInvalidMod\fR" 4 .IX Item "new_from_string($text, %options): returns Mail::SPF::Mod; throws Mail::SPF::ENothingToParse, Mail::SPF::EInvalidMod" \&\fIAbstract\fR. Creates a new SPF record modifier object by parsing the string and any options given. .SS "Class methods" .IX Subsection "Class methods" The following class methods are provided: .IP "\fBname_pattern\fR: returns \fIRegexp\fR" 4 .IX Item "name_pattern: returns Regexp" Returns a regular expression that matches any legal modifier name. .SS "Instance methods" .IX Subsection "Instance methods" The following instance methods are provided: .IP "\fBtext\fR: returns \fIstring\fR; throws \fIMail::SPF::ENoUnparsedText\fR" 4 .IX Item "text: returns string; throws Mail::SPF::ENoUnparsedText" Returns the unparsed text of the modifier. Throws a \&\fIMail::SPF::ENoUnparsedText\fR exception if the modifier was created synthetically instead of being parsed, and no text was provided. .IP "\fBname\fR: returns \fIstring\fR" 4 .IX Item "name: returns string" Returns the name of the modifier. .IP "\fBparams\fR: returns \fIstring\fR" 4 .IX Item "params: returns string" \&\fIAbstract\fR. Returns the modifier's parameters formatted as a string. .Sp A sub-class of Mail::SPF::Mod does not have to implement this method if it supports no parameters, although this is highly unlikely. .IP "\fBstringify\fR: returns \fIstring\fR" 4 .IX Item "stringify: returns string" Formats the modifier's name and parameters as a string and returns it. You can simply use a Mail::SPF::Mod object as a string for the same effect, see "OVERLOADING". .IP "\fBprocess\fR: throws \fIMail::SPF::Result\fR, \fIMail::SPF::Result::Error\fR, \fIMail::SPF::Exception\fR" 4 .IX Item "process: throws Mail::SPF::Result, Mail::SPF::Result::Error, Mail::SPF::Exception" \&\fIAbstract\fR. Processes the modifier. What that means depends on the actual implementation in sub-classes. See "MODIFIER TYPES" below. .Sp This method is abstract and must be implemented by sub-classes of Mail::SPF::Mod. .SH "MODIFIER TYPES" .IX Header "MODIFIER TYPES" There are different basic types of modifiers, which are described below. All of them are provided by the \fBMail::SPF::Mod\fR module. .SS "Global modifiers \- \fBMail::SPF::GlobalMod\fP" .IX Subsection "Global modifiers - Mail::SPF::GlobalMod" \&\fBSPFv1\fR (RFC 4408) only knows "global" modifiers. A global modifier may appear anywhere in an SPF record, but only once. During evaluation of the record, global modifiers are processed after the last mechanism has been evaluated and an SPF result has been determined. .PP The following additional class method is provided by \fBMail::SPF::GlobalMod\fR: .IP "\fBprecedence\fR: returns \fIreal\fR" 4 .IX Item "precedence: returns real" \&\fIAbstract\fR. Returns a \fIreal\fR number between \fB0\fR and \fB1\fR denoting the precedence of the type of the global modifier. Global modifiers present in an SPF record are processed in the order of their precedence values, \fB0\fR meaning "first". .Sp This method is abstract and must be implemented by sub-classes of Mail::SPF::GlobalMod. .PP The following specific instance method is provided by \fBMail::SPF::GlobalMod\fR: .ie n .IP "\fBprocess($server, \fR\fB$request\fR\fB, \fR\fB$result\fR\fB)\fR: throws \fIMail::SPF::Result\fR" 4 .el .IP "\fBprocess($server, \fR\f(CB$request\fR\fB, \fR\f(CB$result\fR\fB)\fR: throws \fIMail::SPF::Result\fR" 4 .IX Item "process($server, $request, $result): throws Mail::SPF::Result" \&\fIAbstract\fR. Processes the modifier. What that means depends on the actual implementation in sub-classes. Takes both a \fIMail::SPF::Server\fR and a \&\fIMail::SPF::Request\fR object. As global modifiers are generally processed \&\fIafter\fR an SPF result has already been determined, takes also the current \&\fIMail::SPF::Result\fR. If the modifier wishes to modify the SPF result, it may throw a different \fIMail::SPF::Result\fR object. .Sp This method is abstract and must be implemented by sub-classes of Mail::SPF::GlobalMod. .SS "Positional modifiers \- \fBMail::SPF::PositionalMod\fP" .IX Subsection "Positional modifiers - Mail::SPF::PositionalMod" \&\fBSender ID\fR (RFC 4406) introduces the concept of "positional" modifiers. According to RFC 4406, a positional modifier must follow a mechanism and applies to that, and only that, mechanism. However, because this definition is not very useful, and because no positional modifiers have been defined based on it as of yet, \fBMail::SPF\fR deviates from RFC 4406 as follows: .PP A positional modifier may appear anywhere in an SPF record, and it is stateful, i.e. it applies to all mechanisms and modifiers that follow it. Positional modifiers are generally multiple, i.e. they may appear any number of times throughout the record. During evaluation of the record, positional modifiers are processed at exactly the time when they are encountered by the evaluator. Consequently, all positional modifiers are processed before an SPF result is determined. .PP The following specific instance method is provided by \&\fBMail::SPF::PositionalMod\fR: .ie n .IP "\fBprocess($server, \fR\fB$request\fR\fB)\fR: throws \fIMail::SPF::Result::Error\fR, \fIMail::SPF::Exception\fR" 4 .el .IP "\fBprocess($server, \fR\f(CB$request\fR\fB)\fR: throws \fIMail::SPF::Result::Error\fR, \fIMail::SPF::Exception\fR" 4 .IX Item "process($server, $request): throws Mail::SPF::Result::Error, Mail::SPF::Exception" \&\fIAbstract\fR. Processes the modifier. What that means depends on the actual implementation in sub-classes. Takes both a \fIMail::SPF::Server\fR and a \&\fIMail::SPF::Request\fR object. As global modifiers are generally processed \&\fIbefore\fR an SPF result has been determined, no result object is available to the modifier. The modifier can (at least at this time) not directly modify the final SPF result, however it may throw an exception to signal an error condition. .Sp This method is abstract and must be implemented by sub-classes of Mail::SPF::PositionalMod. .SS "Unknown modifiers \- \fBMail::SPF::UnknownMod\fP" .IX Subsection "Unknown modifiers - Mail::SPF::UnknownMod" Both \fBSPFv1\fR and \fBSender ID\fR allow unknown modifiers to appear in SPF records in order to allow new modifiers to be introduced without breaking existing implementations. Obviously, unknown modifiers are neither global nor positional, but they may appear any number of times throughout the record and are simply ignored during evaluation of the record. .PP Also obviously, \fBMail::SPF::UnknownMod\fR does not support a \f(CW\*(C`process\*(C'\fR method. .PP The following specific instance method is provided by \&\fBMail::SPF::UnknownMod\fR: .IP "\fBparams\fR: returns \fIstring\fR" 4 .IX Item "params: returns string" Returns the modifier's unparsed value as a string. .SH OVERLOADING .IX Header "OVERLOADING" If a Mail::SPF::Mod object is used as a \fIstring\fR, the \f(CW\*(C`stringify\*(C'\fR method is used to convert the object into a string. .SH "SEE ALSO" .IX Header "SEE ALSO" Mail::SPF::Mod::Redirect, Mail::SPF::Mod::Exp .PP Mail::SPF, Mail::SPF::Record, Mail::SPF::Term .PP .PP For availability, support, and license information, see the README file included with Mail::SPF. .SH AUTHORS .IX Header "AUTHORS" Julian Mehnle , Shevek