Scroll to navigation

Mail::Milter::ContextWrapper(3pm) User Contributed Perl Documentation Mail::Milter::ContextWrapper(3pm)

NAME

Mail::Milter::ContextWrapper - Perl extension for wrappering the milter context

SYNOPSIS

    use Mail::Milter::ContextWrapper;
    my $oldctx = ($ctx from callback);
    # in the connect_callback
    $oldctx->setpriv(new Mail::Milter::ContextWrapper($ctx,
        { methodname => \&methodimpl[, ...] }));
    # in all callbacks
    my $newctx = $ctx->getpriv();
    # in the close_callback
    $oldctx->setpriv(undef);

DESCRIPTION

Mail::Milter::ContextWrapper wraps the milter context with replacement methods defined by the caller. This can be used to intercept context object actions and manipulate them from within a Mail::Milter::Wrapper.

Because the wrappering must occur on every callback, this implementation suggests embedding the wrapper inside the private data of the milter itself. This works with existing milters by providing separate "setpriv" and "getpriv" methods within the wrapper that do not propagate up to the embedded context object.

METHODS

Creates a Mail::Milter::ContextWrapper object. This should be called from the "connect" callback and passed back to "setpriv()".

NAMEs are names of methods to override within the wrapper. These methods will be called with the wrapper as first argument (like a normal object method).

Returns a private data item set by "setpriv()". See Sendmail::Milter for more information. This implementation stores the datum in the wrapper, thus allowing the parent context to store a reference to the wrapper itself.

This method cannot be overridden by the user.

Returns the parent context object stored within this wrapper. Typically used by method overrides to defer back to the real method.

This method cannot be overridden by the user.

Get a keyed data item separate from the "getpriv" private data. This provides out-of-band data storage that need not clobber the single "priv" data item used by most milters.
Sets a private data item to be returned by "getpriv()". See Sendmail::Milter for more information. This implementation stores the datum in the wrapper, thus allowing the parent context to store a reference to the wrapper itself.

This method cannot be overridden by the user.

Set a keyed data item separate from the "getpriv" private data. This provides out-of-band data storage that need not clobber the single "priv" data item used by most milters.

AUTHOR

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

SEE ALSO

Mail::Milter, Sendmail::Milter

2023-01-22 perl v5.36.0