On 2010 Jun 23, at 16:25 , Joseph Brennan wrote:
>> Also, beware: Global variables can persist across different SMTP sessions.
>> Make sure you empty out %Header each time in filter_begin.
> 
> I bet that's it. For exactly this reason I have a stanza at the
> top of filter_begin that empties out per-message globals, or sets
> them to default values, e.g.:

An (imho) much better alternative is not to use global variables AT ALL. If you 
specify 'use strict' (and preferably also 'use warnings') in your 
mimedefang-filter.pl, and localize your variables by declaring them with 'my 
$variablename', you are ensured that your variables are never in an 
inconsistent state.

Global variables simply don't work, if you need to store state, you need to 
store it on disk. The only place where you could in theory pass state in global 
variables, is between filter_begin, filter, filter_multipart and filter_end. If 
you do that, make sure you know where to initialize those variables.

-- 
Jan-Pieter Cornet <joh...@xs4all.net>
Systeembeheer XS4ALL Internet bv
Internet: www.xs4all.nl
Contact: www.xs4all.nl/contact

_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to