Mail::SPF::Result(3) | User Contributed Perl Documentation | Mail::SPF::Result(3) |
Mail::SPF::Result - SPF result class
For the general usage of Mail::SPF::Result objects in code that calls Mail::SPF, see Mail::SPF. For the detailed interface of Mail::SPF::Result and its derivatives, see below.
package Mail::SPF::Foo; use Error ':try'; use Mail::SPF::Result; sub foo { if (...) { $server->throw_result('pass', $request) } else { $server->throw_result('permerror', $request, 'Invalid foo'); } }
package Mail::SPF::Bar; use Error ':try'; use Mail::SPF::Foo; try { Mail::SPF::Foo->foo(); } catch Mail::SPF::Result with { my ($result) = @_; ... };
my $result_name = $result->name; my $result_code = $result->code; my $request = $result->request; my $local_exp = $result->local_explanation; my $authority_exp = $result->authority_explanation if $result->can('authority_explanation'); my $spf_header = $result->received_spf_header;
An object of class Mail::SPF::Result represents the result of an SPF request.
There is usually no need to construct an SPF result object directly using the "new" constructor. Instead, use the "throw" class method to signal to the calling code that a definite SPF result has been determined. In other words, use Mail::SPF::Result and its derivatives just like exceptions. See Error or "eval" in perlfunc for how to handle exceptions in Perl.
The following constructor is provided:
The following class methods are provided:
Note: Do not write code invoking "throw" on literal result class names as this would ignore any derivative result classes provided by Mail::SPF extension modules. Invoke the "throw_result" method on a Mail::SPF::Server object instead.
This method must be implemented by sub-classes of Mail::SPF::Result for which the result name differs from the result code.
For example, "Mail::SPF::Result::NeutralByDefault->isa_by_name('neutral')" returns true.
This method is abstract and must be implemented by sub-classes of Mail::SPF::Result.
Note: The "isa_by_name" method provides a superset of this method's functionality.
The following instance methods are provided:
The local explanation is prefixed with the authority domain whose sender policy is responsible for the result. If the responsible sender policy referred to another domain's policy (using the "include" mechanism or the "redirect" modifier), that other domain which is directly responsible for the result is also included in the local explanation's head. For example:
example.com: <local-explanation>
The authority domain "example.com"'s sender policy is directly responsible for the result.
example.com ... other.example.org: <local-explanation>
The authority domain "example.com" (directly or indirectly) referred to the domain "other.example.org", whose sender policy then led to the result.
If a Mail::SPF::Result object is used as a string, the "stringify" method is used to convert the object into a string.
The following result classes are provided:
This is a special case of the "neutral" result that is thrown as a default when "falling off" the end of the record during evaluation. See RFC 4408, 4.7.
The following result classes have additional functionality:
Mail::SPF, Mail::SPF::Server, Error, "eval" in perlfunc
<http://tools.ietf.org/html/rfc4408>
For availability, support, and license information, see the README file included with Mail::SPF.
Julian Mehnle <julian@mehnle.net>
2024-08-03 | perl v5.34.0 |