[Mimedefang] Weird issue
johnpc at xs4all.net
Wed Jun 23 11:51:16 EDT 2010
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 <johnpc at xs4all.net>
Systeembeheer XS4ALL Internet bv
More information about the MIMEDefang