procmail
[Top] [All Lists]

ORing with scoring

1998-04-01 11:33:18
Jari Aalto wrote,

| What I had in mind was scoring, but I guess my fingers forgot to write:
| 
|     * 1^0 H ??
|     * 1^0 B ??

That will work, but it isn't the best way to do ORing, because if a match is
found to the first condition procmail still takes the trouble to test the
second one.

Better, use the supremum score on each condition:

     * 9876543210^0 first_condition_to_be_ORed
     * 9876543210^0 second_condition_to_be_ORed
     * ... etc. ...
     * 1^0 last_condition_to_be_ORed

Upon reaching the supremum score, procmail will skip all remaining weighted
conditions on the recipe, deeming them matched.  Since all conditions on this
recipe are weighted, once procmail finds one matched condition it will skip
the rest and execute the action.

You could use 9876543210 on the last condition as well, but "1" might be
easier to type.  (Actually the maximum is 2147483647, but 9876543210 is
easier to remember and will function just as well for this specific use.)

| Thanks David, the code snippet was a good example for integrating HB.

You're welcome, Jari.

<Prev in Thread] Current Thread [Next in Thread>