Re: [Exim] Condition with and

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Nico Erfurth
Dátum:  
Címzett: Matt Bernstein, exim-users
Tárgy: Re: [Exim] Condition with and
Matt Bernstein wrote:
> At 09:26 +0200 Jan Suchanek wrote:
>
>
>>>condition = ${if and { \
>>>   {!eq {${lookup pgsql{SQL_REJECT_LIST}}} {${lc:$sender_address}} } \
>>>   { eq {${lookup pgsql{IS_A_LIST}}} {${lc_$local_part}} } \
>>>                    } {true}{false}}

>>
>>this is exactly what I needed. This condition works now. But the one
>
>
> It is quite inefficient to do the second lookup if the first had failed.
> You can do short-circuit and & or using this kind of (untested) trick:
>
> and:    ${if <cond1> {${if <cond2>{1}{0}} {0}}
> or:    ${if <cond1> {1} {${if <cond2>{1}{0}}}

>
> It looks a little less pretty, but saves you some computation.


IIRC exim will do short evaluation. So if the first condition fails,
exim will skip the other ones (in fact it parses them, but will not
execute it).
Your trick will work too, but will not buy you anything ;).

ciao