| Mail-SPF documentation | Contained in the Mail-SPF distribution. |
Mail::SPF::Mech::Include - SPF record include mechanism class
An object of class Mail::SPF::Mech::Include represents an SPF record
mechanism of type include.
The following constructors are provided:
Creates a new SPF record include mechanism object.
%options is a list of key/value pairs representing any of the following options:
Creates a new SPF record include mechanism object by parsing the string and
any options given.
The following class methods are provided:
Returns 'include'.
Returns a regular expression that matches a mechanism name of 'include'.
The following instance methods are provided:
Returns the domain-spec parameter of the mechanism.
Performs a recursive SPF check using the given SPF server and request objects and substituting the mechanism's target domain name for the request's authority domain. The result of the recursive SPF check is translated as follows:
Recursive result | Effect
------------------+-----------------
pass | return true
fail | return false
softfail | return false
neutral | return false
none | throw PermError
permerror | throw PermError
temperror | throw TempError
See RFC 4408, 5.2, for the exact algorithm used.
Mail::SPF, Mail::SPF::Record, Mail::SPF::Term, Mail::SPF::Mech
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>
| Mail-SPF documentation | Contained in the Mail-SPF distribution. |
# # Mail::SPF::Mech::Include # SPF record "include" mechanism class. # # (C) 2005-2008 Julian Mehnle <julian@mehnle.net> # 2005 Shevek <cpan@anarres.org> # $Id: Include.pm 50 2008-08-17 21:28:15Z Julian Mehnle $ # ############################################################################## package Mail::SPF::Mech::Include;
use warnings; use strict; use base 'Mail::SPF::Mech'; use constant TRUE => (0 == 0); use constant FALSE => not TRUE; use constant name => 'include'; use constant name_pattern => qr/${\name}/i;
sub parse_params { my ($self) = @_; $self->parse_domain_spec(TRUE); return; }
sub params { my ($self) = @_; return defined($self->{domain_spec}) ? ':' . $self->{domain_spec} : undef; }
# Make read-only accessor: __PACKAGE__->make_accessor('domain_spec', TRUE);
sub match { my ($self, $server, $request) = @_; $server->count_dns_interactive_term($request); # Create sub-request with mutated authority domain: my $authority_domain = $self->domain($server, $request); my $sub_request = $request->new_sub_request(authority_domain => $authority_domain); # Process sub-request: my $result = $server->process($sub_request); # Translate result of sub-request (RFC 4408, 5/9): return TRUE if $result->isa('Mail::SPF::Result::Pass'); return FALSE if $result->isa('Mail::SPF::Result::Fail') or $result->isa('Mail::SPF::Result::SoftFail') or $result->isa('Mail::SPF::Result::Neutral'); $server->throw_result('permerror', $request, "Included domain '$authority_domain' has no applicable sender policy") if $result->isa('Mail::SPF::Result::None'); # Propagate any other results (including {Perm,Temp}Error) as-is: $result->throw(); }
TRUE;