Mail::SPF::Mech



Mail::SPF::Mech

NAME
DESCRIPTION
OVERLOADING
SEE ALSO
AUTHORS

NAME

Mail::SPF::Mech − SPF record mechanism base class

DESCRIPTION

An object of class Mail::SPF::Mech represents a mechanism within an SPF record. Mail::SPF::Mech cannot be instantiated directly. Create an instance of a concrete sub-class instead.

Constructors
The following constructors are provided:
new(%options)
: returns Mail::SPF::Mech

Abstract. Creates a new SPF record mechanism object.

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

A string denoting the unparsed text of the mechanism.

qualifier

A single-character string denoting the qualifier of the mechanism. Any of the following may be specified: ’+’ ("Pass"), ’−’ ("Fail"), ’~’ ("SoftFail"), ’?’ ("Neutral"). See RFC 4408, 4.6.2 and 2.5, for their meanings. Defaults to ’+’.

name

A string denoting the name of the mechanism. Required if a generic Mail::SPF::Mech object (as opposed to a specific sub-class) is being constructed.

ip_network

A NetAddr::IP object denoting an optional IP address network parameter of the mechanism. Can be either an IPv4 or an IPv6 address, with an optional network prefix length. IPv4−mapped IPv6 addresses (e.g. ’::ffff:192.168.0.1’) must not be specified directly, but as plain IPv4 addresses.

domain_spec

Either a plain string or a Mail::SPF::MacroString object denoting an optional "domain−spec" parameter of the mechanism.

ipv4_prefix_length
ipv6_prefix_length

A string denoting an optional IPv4 or IPv6 network prefix length for the "domain_spec" of the mechanism. Note that these options do not apply to the "ip_network" option, which already includes an optional network prefix length.

Other options may be specified by sub-classes of Mail::SPF::Mech.

new_from_string($text, %options): returns Mail::SPF::Mech; throws
Mail::SPF::ENothingToParse
, Mail::SPF::EInvalidMech

Abstract. Creates a new SPF record mechanism object by parsing the string and any options given.

Class methods
The following class methods are provided:
default_qualifier
: returns string

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

default_ipv4_prefix_length: returns integer

Returns the default IPv4 network prefix length, i.e. 32.

default_ipv6_prefix_length: returns integer

Returns the default IPv6 network prefix length, i.e. 128.

qualifier_pattern: returns Regexp

Returns a regular expression that matches any legal mechanism qualifier, i.e. ’+’, ’−’, ’~’, or ’?’.

name: returns string

Abstract. Returns the name of the mechanism.

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

name_pattern: returns Regexp

Returns a regular expression that matches any legal mechanism name.

Instance methods
The following instance methods are provided:
text
: returns string; throws Mail::SPF::ENoUnparsedText

Returns the unparsed text of the mechanism. Throws a Mail::SPF::ENoUnparsedText exception if the mechanism was created synthetically instead of being parsed, and no text was provided.

qualifier: returns string

Returns the qualifier of the mechanism. See the description of the "new" constructor’s "qualifier" option.

params: returns string

Abstract. Returns the mechanism’s parameters formatted as a string.

A sub-class of Mail::SPF::Mech does not have to implement this method if it supports no parameters.

stringify: returns string

Formats the mechanism’s qualifier, name, and parameters as a string and returns it. (A qualifier that matches the default of ’+’ is omitted.) You can simply use a Mail::SPF::Mech object as a string for the same effect, see " OVERLOADING ".

domain($server, $request): returns string

Returns the target domain of the mechanism. Depending on whether the mechanism does have an explicit "domain_spec" parameter, this is either the macro-expanded "domain_spec" parameter, or the request’s authority domain (see "authority_domain" in Mail::SPF::Request) otherwise. Both a Mail::SPF::Server and a Mail::SPF::Request object are required for resolving the target domain.

match($server, $request): returns boolean; throws
Mail::SPF::Result::Error

Abstract. Checks whether the mechanism matches the parameters of the given request (see Mail::SPF::Request) and returns true if it does, or false otherwise. In any case, takes both a Mail::SPF::Server and a Mail::SPF::Request object.

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

match_in_domain($server, $request): returns boolean; throws
Mail::SPF::Result::Error

match_in_domain($server, $request,
$domain): returns boolean; throws
Mail::SPF::Result::Error

Checks whether the mechanism’s target domain name (that is, any of its DNS "A" or "AAAA" records) matches the given request’s IP address (see "ip_address" in Mail::SPF::Request), and returns true if it does, or false otherwise. If an explicit domain is specified, it is used instead of the mechanism’s target domain. The mechanism’s IP network prefix lengths are respected when matching DNS address records against the request’s IP address. See RFC 4408, 5, for the exact algorithm used.

This method exists mainly for the convenience of sub-classes of Mail::SPF::Mech.

explain($server, $request, $result)

Locally generates an explanation for why the mechanism caused the given result, and stores it in the given request object’s state.

There is no need to override this method in sub-classes. See the "explanation_template" method.

explanation_template($server, $request, $result): returns string

Returns a macro string template for a locally generated explanation for why the mechanism caused the given result object.

Sub-classes should either define an "explanation_templates_by_result_code" hash constant with their own templates, or override this method.

OVERLOADING

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

SEE ALSO

Mail::SPF::Mech::All, Mail::SPF::Mech::IP4, Mail::SPF::Mech::IP6, Mail::SPF::Mech::A, Mail::SPF::Mech::MX, Mail::SPF::Mech::PTR, Mail::SPF::Mech::Exists, Mail::SPF::Mech::Include

Mail::SPF, Mail::SPF::Record, Mail::SPF::Term

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