[Mimedefang] Re: modular filter (was DNS Lookups in MD)
Kevin A. McGrail
kmcgrail at pccc.com
Mon Jul 23 20:22:41 EDT 2007
> despite my searching, I
> can't
>>find the info. I'm looking to do something like put all the reverse
> DNS
>>info in a separate file and use a C-esque #INCLUDE.
>
> In filter_initialize(), do the following:
>
> require "local_module.pl";
>
>
> In local_module.pl, define your subroutines as normal, and then call
> them from wherever in your filter you need them - since the "require"
> statement brings them in before anything else in your filter runs, they
> will always be in scope.
>
> require "filter_sender.pl";
> require "filter_recipient.pl";
> require "filter_relay.pl";
> require "filter.pl";
> require "filter_begin.pl";
> require "filter_end.pl";
> require "filter_multipart.pl"
Paul,
I'm still struggling with this. Ideally, I want to place code snippets that
aren't routines into a file that is then inlined for the mimedefang-filter.
Someone showed me this idea a while back for RelayRegistry but I did not
understand the error of my ways. Now I can't for the life of me find the
example.
But here is what doesn't work for me:
#AT SOME POINT DEFINE A VARIABLE IN MIMEDEFANG
my $auth_sender = some_routine();
#THEN TRY AND INCLUDE MY SNIPPET
do "file.pl"
#Contents of file.pl is just bare code:
if ($auth_sender > 0) {
#do stuff
}
1;
Perhaps all I need to do is change $auth_sender in file.pl to
$main::auth_sender?
regards,
KAM
More information about the MIMEDefang
mailing list