More than one Custom Function

Rick Cooper rcooper at dwford.com
Thu May 14 12:56:29 IST 2009


----Original Message----
From: mailscanner-bounces at lists.mailscanner.info
[mailto:mailscanner-bounces at lists.mailscanner.info] On Behalf Of Paul Sent:
Thursday, May 14, 2009 3:57 AM To: MailScanner discussion
Subject: Re: More than one Custom Function

> Julian Field wrote:
>> 
>> 
>> On 13/05/2009 12:32, Paul Houselander wrote:
>>> Hi
>>> 
>>> I have a mailscanner set up that uses the Always Looked Up Last
>>> directive to call a custom function I wrote that logs to a postgres
>>> database. 
>>> 
>>> I want to try to get it to now to ALSO log to a mysql database using
>>> mailwatch. 
>>> 
>>> Is it possible to run 2 CustomFunctions from the same directive?
>>> 
>> Why not just write a Custom Function that calls both bits of code?
>> Just pass all the parameters to both functions, simple as that.
>> 
>> Jules
>> 
> Hi Jules
> 
> I did think about doing that, it was just I recalled someone writing a
> wrapper that allowed you to call 2 custom functions? I may well have
> drembt it as cant find anything via the wiki or searching through the
> archives!

I do this with a function called wrapper (not real unique)

In MailScanner.conf

# If you want to use it, read CustomConfig.pm.
Always Looked Up Last = &Wrapper


In CustomConfig.pm

sub InitWrapper {
 InitExtendedLogger();
 InitMailWatchLogging();
}

sub Wrapper {
 my($msg) = @_;
 ExtendedLogger($msg);
 MailWatchLogging($msg);
}

sub EndWrapper {
 EndExtendedLogger();
 EndMailWatchLogging();
}

The sub Wrapper calls the functions, the InitWrapper calls the other Init
functions and EndWrapper calls the other End functions

Rick


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the MailScanner mailing list