Mail::Milter::Object - Perl extension to encapsulate a milter in an object
package Foo; use base Mail::Milter::Object; sub connect_callback { my $this = shift; my $ctx = shift; my @connect_args = @_; ... } ... my $milter = new Foo;
Normally, milters passed to Sendmail::Milter consist of nondescript hash references. Mail::Milter::Object transforms these callback hashes into fully qualified objects that are easier to maintain and understand. In conjunction with Mail::Milter::Chain, this also allows for a more modular approach to milter implementation, by allowing each milter to be a small, granular object that can exist independently of other milters.
Sendmail::Milter
Mail::Milter::Object
Mail::Milter::Chain
Each object inheriting from this class has access to the hash reference making up the object itself. Two caveats must be noted when accessing this hashref:
* Key names used for private data should be prefixed by an underscore (_) in order to prevent accidental recognition as a callback name.
* Since a milter object can be reused many times throughout its existence, and perhaps reentrantly if threads are in use, the hashref should contain only global configuration data for this object rather than per-message data. Data stored per message or connection should be stashed in the milter context object by calling getpriv() and setpriv() on the context object.
getpriv()
setpriv()
Creates a new Mail::Milter::Object. The fully qualified class is scanned for milter callback methods with names of the form CALLBACK_callback. If such a method exists, a corresponding callback entry point is added to this object.
Todd Vierling, <tv@duh.org> <tv@pobox.com>
Mail::Milter, Sendmail::Milter.
To install Mail::Milter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::Milter
CPAN shell
perl -MCPAN -e shell install Mail::Milter
For more information on module installation, please visit the detailed CPAN module installation guide.