Hi,
I have recently received messages from promail starters to say that
they don't understand how to use my (or Alan's or others) procmail
modules, so I thought to write about it. Let's get some basic concepts
straightened first (as I use them):
_subroutine_ = A piece of code that gets something in `INPUT' and
responds with `OUTPUT'. Subroutine is not message specific.
_recipe_ = A piece of code, that is somewhat self containing:
It reads something from the message or does something
according to matches in message. Recipe may be message specific.
In my procmail module library's case, some of the modules
are recipes and some work like subroutines. First, visualise
following familiar programming language pseudo code:
(ret-val1, ret-val2 ...) = Function( arg1, arg2, arg3 ...)
Function may return multiple arguments and multiple arguments
can be passed to it. Clear so far. Let's show how this applies to
procmail modules:
RC_FUNCTION = $PMSRC/pm-xxx.rc # name the subroutine/module
RC_FUNCTION2 = ...
INPUT = "value" # Set the arg1 for module
INCLUDERC = $RC_FUNCTION # Call Function( $arg1 )
:0 # Examine function ret val
* ERROR ?? yes
...
If it were recipe/module, the call would be almost the same, but
instead of returning values, the recipe/module most likely does
something to your message or writes something to the data files or etc.
_Recipe/module_ is much higher level hierarchy, because it may call
multiple subroutine/modules. The distinction between subroutine and
recipe module type is not crystal clear, but I hope the above will
clarify a bit the Procmail module/subroutine/recipe concept.
jari