man Mail::Milter::Object () - Perl extension to encapsulate a milter in an object

NAME

Mail::Milter::Object - Perl extension to encapsulate a milter in an object

SYNOPSIS

    package Foo;
    use base Mail::Milter::Object;

    sub connect_callback {
        my $this = shift;
        my $ctx = shift;
        my @connect_args = @_;
        ...
    }

    ...
    my $milter = new Foo;

DESCRIPTION

Normally, milters passed to CWSendmail::Milter consist of nondescript hash references. CWMail::Milter::Object transforms these callback hashes into fully qualified objects that are easier to maintain and understand. In conjunction with CWMail::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.

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 CWgetpriv() and CWsetpriv() on the context object.

METHODS

new()
Creates a new CWMail::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.

AUTHOR

Todd Vierling, <tv@duh.org> <tv@pobox.com>

SEE ALSO

Mail::Milter, Sendmail::Milter.