Mail::SPF::Mech - SPF record mechanism base class
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.
The following constructors are provided:
Abstract. Creates a new SPF record mechanism object.
%options is a list of key/value pairs representing any of the following options:
Pass
), '-' (Fail
),
'~' (SoftFail
), '?' (Neutral
). See RFC 4408, 4.6.2 and 2.5, for
their meanings. Defaults to '+'.
domain-spec
parameter of the mechanism.
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.
The following class methods are provided:
The following instance methods are provided:
Returns the qualifier of the mechanism. See the description of the new
constructor's qualifier
option.
Returns the name of the mechanism.
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.
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".
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 Mail::SPF::Request/authority_domain) otherwise. Both a
Mail::SPF::Server and a Mail::SPF::Request object are required for
resolving the target domain.
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.
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
Mail::SPF::Request/ip_address), 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.
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.
Returns a macro string template for a locally generated explanation for why the mechanism caused the given result.
Sub-classes should either define an explanation_templates_by_result_code
hash constant with their own templates, or override this method.
If a Mail::SPF::Mech object is used as a string, the stringify
method is
used to convert the object into a string.
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.
Julian Mehnle <julian@mehnle.net>, Shevek <cpan@anarres.org>