Mailing List Archive

Re: [Comment] Re: [cpan #5313] Cannot use ? : in meta tests
BTW: I'm moving the discussion over to the spamassassin-users list since
it's general spamassassin chat here. :)

On Fri, Feb 13, 2004 at 12:14:39AM -0500, (David Muir Sharnoff) via RT wrote:
> ? : is the only trinary operator in C, perl, etc.... I suspect
> you knew that.

?: I know, :? I don't. Some kind of wierd smiley...? ;)

Yeah, meta rules aren't really if-then-else by themselves, but you can
do it with multiple meta rules. Something like:

meta RULE1 RULEA || RULEB
score RULE1 10
meta RULE2 !RULE1 && RULEC
score RULE2 20
meta RULE3 !RULE1 && !RULE2
score RULE3 1

to mean:

if ( RULEA || RULEB ) { $score+=10 }
elsif ( RULEC ) { $score+=20 )
else { $score+=1 }

SA will deal with the dependencies and make it do the right thing. :)

--
Randomly Generated Tagline:
I dunno. Perhaps you should be happy that I have a policy of refraining
from grumbling about handicapped operating systems. :-)
-- Larry Wall in <199808291719.KAA12244@wall.org>