Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  MAIL::SPF::RECORD (3)

.ds Aq ’


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



    Creating a record from a string

    use Mail::SPF::v1::Record;

    my $record = Mail::SPF::v1::Record->new_from_string("v=spf1 a mx -all");

    Creating a record synthetically

    use Mail::SPF::v2::Record;

    my $record = Mail::SPF::v2::Record->new(
        scopes      => [mfrom, pra],
        terms       => [
            Mail::SPF::Mech::All->new(qualifier => -)
        global_mods => [
            Mail::SPF::Mod::Exp->new(domain_spec =>


<B>Mail::SPF::RecordB> is an abstract base class for SPF records. It cannot be instantiated directly. Create an instance of a concrete sub-class instead.


The following constructors are provided:
<B>new(%options)B>: returns Mail::SPF::Record Creates a new SPF record object.

%options is a list of key/value pairs representing any of the following options:
<B>textB> A string denoting the unparsed text of the record.
<B>scopesB> A reference to an array of strings denoting the scopes that are covered by the record (see the description of the scope option of Mail::SPF::Request’s new constructor).
<B>termsB> A reference to an array of Mail::SPF::Term (i.e. Mail::SPF::Mech or Mail::SPF::Mod) objects that make up the record. Mail::SPF::GlobalMod objects must not be included here, but should be specified using the global_mods option instead.
<B>global_modsB> A reference to an array of Mail::SPF::GlobalMod objects that are global modifiers of the record.

<B>new_from_string($text, B>%options<B>)B>: returns Mail::SPF::Record; throws Mail::SPF::ENothingToParse, Mail::SPF::EInvalidRecordVersion, Mail::SPF::ESyntaxError Creates a new SPF record object by parsing the string and any options given.

    Class methods

The following class methods are provided:
<B>version_tag_patternB>: returns Regexp Abstract. Returns a regular expression that matches a legal version tag.

This method is abstract and must be implemented by sub-classes of Mail::SPF::Record.

<B>default_qualifierB>: returns string Returns the default qualifier, i.e. <B>’+’B>.
<B>results_by_qualifierB>: returns hash of string Returns a reference to a hash that maps qualifiers to result codes as follows:

     Qualifier | Result code
         +     | pass
         -     | fail
         ~     | softfail
         ?     | neutral

    Instance methods

The following instance methods are provided:
<B>textB>: returns string; throws Mail::SPF::ENoUnparsedText Returns the unparsed text of the record. Throws a Mail::SPF::ENoUnparsedText exception if the record was created synthetically instead of being parsed, and no text was provided.
<B>version_tagB>: returns string Abstract. Returns the version tag of the record.

This method is abstract and must be implemented by sub-classes of Mail::SPF::Record.

<B>scopesB>: returns list of string Returns a list of the scopes that are covered by the record. See the description of the new constructor’s scopes option.
<B>termsB>: returns list of Mail::SPF::Term Returns a list of the terms that make up the record, excluding any global modifiers, which are returned by the global_mods method. See the description of the new constructor’s terms option.
<B>global_modsB>: returns list of Mail::SPF::GlobalMod Returns a list of the global modifiers of the record, ordered ascending by modifier precedence. See the description of the new constructor’s global_mods option.
<B>global_mod($mod_name)B>: returns Mail::SPF::GlobalMod Returns the global modifier of the given name if it is present in the record. Returns <B>undefB> otherwise. Use this method if you wish to retrieve a specific global modifier as opposed to getting all of them.
<B>stringifyB>: returns string Returns the record’s version tag and terms (including the global modifiers) formatted as a string. You can simply use a Mail::SPF::Record object as a string for the same effect, see OVERLOADING.
<B>eval($server, B>$request<B>)B>: throws Mail::SPF::Result Evaluates the SPF record in the context of the request parameters represented by the given Mail::SPF::Request object. The given Mail::SPF::Server object is used for performing DNS look-ups. Throws a Mail::SPF::Result object matching the outcome of the evaluation; see Mail::SPF::Result. See RFC 4408, 4.6 and 4.7, for the exact algorithm used.


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


Mail::SPF, Mail::SPF::v1::Record, Mail::SPF::v2::Record, Mail::SPF::Term, Mail::SPF::Mech, Mail::SPF::Mod


For availability, support, and license information, see the README file included with Mail::SPF.


Julian Mehnle <>, Shevek <>
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 MAIL::SPF::RECORD (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.