procmail
[Top] [All Lists]

Re: Scoring Function Question

1999-04-14 10:41:50
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!
DWT> No.  Procmail doesn't read ahead, so when it finishes the second condition
DWT> it doesn't yet know that all the rest of the conditions are going to be
DWT> unweighted and that, whether those remaining conditions match or not, there
DWT> will be a zero score and the recipe cannot match.  It won't know that until
DWT> it reaches the action line.

DWT> However, if the score reached infemum (-2147483647), procmail *would* bail
DWT> out on the recipe without bothering to read the try of the conditions.

DWT> | Or will it still try and test the two From: headers?

Then with negations of the above conditions, could something be done
so that after the two tests, the value would be infemum?

DWT> It will, but if the first one fails ... that is if the regexp matches and
DWT> the condition, being negated, thus fails ... it will bail out then and not
DWT> bother testing the second unweighted condition.  BTW, you can combine the
DWT> last two conditions:

DWT> * ! H ?? From:.*(Person1|Person2)

Thanks for this oversite.

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.

Cheers to all,

        --Ralph