[Mimedefang] A global variable per email

David F. Skoll dfs at roaringpenguin.com
Mon Apr 9 15:43:52 EDT 2007


Oliver Schulze L. wrote:

> I need to have a variable per email in the functions: filter,
> filter_multipart, filter_end

That's fine.  All of those functions get called one after the other in
the same process.

So initialize your variables in filter_begin.  You can define them
in filter/filter_multipart and they'll be available in filter_end.

> As an example, I need to have in filter_end:
> - the list of all extensions, filenames, etc of the email
> - the list of all virus found
> - if a bad extension was deleted and which one

sub filter_begin
{
	@extensions = qw();
	@filenames = qw();
	@viruses = qw();
}

sub filter
{
	# ...
	push(@extensions, $some_extension);
	push(@filenames, $some_filename);
	if (virus_found()) {
	        push(@viruses, $some_virusname);
	}
}

sub filter_end
{
	# You can use @extensions, @filenames and @viruses here
}

Regards,

David.



More information about the MIMEDefang mailing list