Author: Mike Scott Date: To: exim-users Subject: [Exim] user variables in filters
I use a ${perl} expansion in my filter that has five possible returns
(strings). This means that I need to check it a maximum of four times in my
filter, which means calling it four times! I don't need a stopwatch to tell
me this is expensive. I would like to save his result to a variable, and
use the variable instead, but all I can find in the Exim filter docs is the
'add' command and $n variables.
I could always change my Perl to return integers (1-5), and use something
like this (for the sake of brevity, I'll only check 3 conditions):
add ${perl{msgTypeAnalyzer}} to n1
if $n1 is not below 1 and $n1 is not above 1 then
(do stuff)
endif
if $n1 is not below 2 and $n1 is not above 2 then
(do stuff)
endif
if $n1 is not below 3 and $n1 is not above 3 then
(do stuff)
endif
Please comment if there is a better/cleaner way to do this. Note: I
intentionally don't use deeply nested elif structures (don't like them :-{).
Note #2: My O'Reilly bible makes no mention of a direct integer comparison
such as 'number1' is 'number2' - sigh....