Mail::SPF::Record



Mail::SPF::Record

NAME
SYNOPSIS
DESCRIPTION
OVERLOADING
SEE ALSO
AUTHORS

NAME

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

SYNOPSIS

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::A−>new(),
            Mail::SPF::Mech::MX−>new(),
            Mail::SPF::Mech::All−>new(qualifier => '−')
        ],
        global_mods => [
            Mail::SPF::Mod::Exp−>new(domain_spec => 'spf−exp.example.com')
        ]
    );

DESCRIPTION

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

Constructor
The following constructors are provided:
new(%options)
: returns Mail::SPF::Record

Creates a new SPF record object.

%options is a list of key/value pairs representing any of the following options:
text

A string denoting the unparsed text of the record.

scopes

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).

terms

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.

global_mods

A reference to an array of Mail::SPF::GlobalMod objects that are global modifiers of the record.

new_from_string($text, %options): 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:
version_tag_pattern
: 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.

default_qualifier: returns string

Returns the default qualifier, i.e. ’+’.

results_by_qualifier: 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:
text
: 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.

version_tag: 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.

scopes: 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.

terms: 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.

global_mods: 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.

global_mod($mod_name): returns Mail::SPF::GlobalMod

Returns the global modifier of the given name if it is present in the record. Returns undef otherwise. Use this method if you wish to retrieve a specific global modifier as opposed to getting all of them.

stringify: 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 ".

eval($server, $request): 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.

OVERLOADING

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

SEE ALSO

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

<http://www.ietf.org/rfc/rfc4408.txt>

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

AUTHORS

Julian Mehnle <julian@mehnle.net>, Shevek <cpan@anarres.org>






Opportunity


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.





Free Software


Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.


Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.





Free Books


The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.


Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.





Education


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.


Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.