[Mimedefang] Custom variables in filter, undef needed in filter_end?

David F. Skoll dfs at roaringpenguin.com
Wed Apr 12 13:25:03 EDT 2006

Brandon Hutchinson wrote:

> We are running MD 2.56 with the MD multiplexor and embedded Perl.

> In our configuration, we modify some custom variables in the filter 
> subroutine, and use these values in filter_end for attachment reporting, for 
> example.

> If we do not undef these variables after using them in filter_end,
> subsequent MD slaves appear to add to them. For example, our array
> containing a list of attachments will grow.

Right.  A given slave process generally handles more than one message,
and any variables you set will remain set for the life of the process.

> Is it recommended to undef these variables in filter_end? Is this documented 
> anywhere?

It's probably easier to do all your variable initialization in
filter_begin.  It's also safer, because you're guaranteed that the variable
initialization code will have executed before any calls to filter.  If you
do it in filter_end, then the initialization code won't have been called
for the very first message to be processed.

> Will $Sender or any of the elements in @Recipients ever have angle brackets?

Yes.  In fact, always.



More information about the MIMEDefang mailing list