procmail
[Top] [All Lists]

Re: Scoring Function Question

1999-04-14 14:40:04
Ralph SOBEK <sobek(_at_)irit(_dot_)fr> writes:
Thanks for your answers, David!

"DWT" == David W Tamkin <dattier(_at_)Mcs(_dot_)Net> writes:

DWT> Ralph Sobek asked,
DWT> | If I have the following recipe:
DWT> | 
DWT> | :0B:
DWT> | * 1^1000 H ?? ^\/(From|Subject):.*Condition1
DWT> | * 1^1000 ()\/Condition2
DWT> | * ! H ?? From:.*Person1
DWT> | * ! H ?? From:.*Person2
DWT> | | (formail -z ...)
DWT> | 
DWT> | Will this fail immediately when the two scores each returns 0? 

I reread the procmailsc man page and changed the scoring accordingly
to:

:0 B
* 1000^0 H ?? ^\/(From|Subject):.*Condition
* 1000^0 ()\/Condition

That still did not help!

No, but to expand upon David's answer, if you shortcircut all the
scoring, it will:

        :0:
        *  9876543210^0 ^\/(From|Subject):.*Condition1
        *  9876543210^0 B ?? ()\/Condition2
        * -9876543210^0
        * ! From:.*(Person1|Person2)
        | (formail -z ...)

That way if either of the first two conditions match, procmail skip all
the rest of the scoring conditions, including the third with its
infimum weight.  If neither of the first two conditions matches then
the third will cause procmail to skip the remaining conditions and fail
the entire recipe.



DWT> Question for the experts: Ralph's example has the `B' flag on the recipe
DWT> but three of the four conditions override it with `H ??'; would it be any
DWT> more or less efficient to have (or imply) the `H' flag and then override
DWT> it with `B ??' for the one condition of the four that looks at the body?

I suppose that it would be more efficient to reverse things here.

It's all done with pointers, so the cost is trivial.  For something
that cheap, readability is probably the deciding factor.


Philip Guenther