Perl extension for wrappering milter objects
use Mail::Milter::Wrapper;
my $milter = ...; my $wrapper = new Mail::Milter::Wrapper($milter, \&foo);
use Sendmail::Milter; ... Sendmail::Milter::register('foo', $wrapper, SMFI_CURR_ACTS);
Mail::Milter::Wrapper wraps another milter, allowing for interception of the passed arguments and/or return code of the contained milter.
Creates a Mail::Milter::Wrapper object. \s-1MILTER\s0 is the milter to wrap, which may be a plain hash reference or an instance of a hashref object such as \*(C`Mail::Milter::Object\*(C'. \s-1CODEREF\s0 is the wrapper subroutine. CALLBACKs, if specified, are named callbacks which are needed by the wrapper, even if the contained milter does not use them. The wrapper subroutine will be called with the following arguments, in this order: * reference to the wrapper * name of callback * subroutine reference to call into the wrapped milter * arguments for the callback (>= 0) This subroutine should \s-1ALWAYS\s0 pass the \*(L"close\*(R" callback through to the contained milter. Failure to do so may corrupt the contained milter's state information and cause memory leaks. As an example, a simple subroutine which just passes the callback through might be written as: sub callback_wrapper { shift; # don't need $this my $cbname = shift; my $callback_sub = shift; &$callback_sub(@_); }
Todd Vierling, <[email protected]> <[email protected]>
Mail::Milter, Sendmail::Milter