Standard actions, predicates

UpCommands
Sitemap
 

Fmail currently provides six standard Actions and two standard Predicates.

These are:

Standard actions
Subcmd Description
do
script

Executes the <script> in the context of the caller. Basically syntactic sugar to allow the writing of more readable rules.

All defined Actions are available in the script as regular commands.

Example

on {...} do {...}
	    
stop

This action aborts the processing of the rules in the current rule script and in all rule scripts calling it.

Example

never stop
	    
discard

The same as stop. Should be used if the abortion causes the rule engine to lose information, for example the mail currently processed by it.

Example

default discard
	    
pipeto
cmd args

Executes the external command <cmd> with all additionally provided arguments (<args>) and pipes a serialized representation of the input object into its standard input.

The serialization is obtained by a call to the 'copy2channel' method of the input object and immediately written into the internal channel, which was given as first and only argument to the call.

Note: The above places a restriction on the interface of the input object and must not be used if the actual input object is unable to meet it (existence and semantics of 'copy2channel'). This is in the grey area between completely generic and specialized actions (like for mail).

The example below pipes the input object into a command from the MH mail system and thus assumes that the input is a mail.

Example

pipeto /usr/lib/mh/rcvstore +junk
	    
cfgset
key value

See ::fmail::cfgSet.

cfgget
key

See ::fmail::cfgGet.

Standard predicates
Subcmd Description
allof
args

Elements of <args> whose first word is the name of a predicate are evaluated by executing that predicate with the rest of the words in that element as its arguments.

All other elements are evaluated as regular tcl expressions.

This predicate evaluates to true if and only if all of its arguments evaluate to true. It is therefore a more verbose form of the &&-operator.

The predicate announces itself through the ::fmail::op variable by setting its contents to 'allof'.

This allows predicates in its argument list to change their behaviour based on their qualification.

anyof
args

See allof for a description on how the arguments are evaluated.

This predicate evaluates to true if and only if at least one of its arguments evaluates to true. It is therefore a more verbose form of the ||-operator.

The predicate announces itself through the ::fmail::op variable by setting its contents to 'anyof'.

This allows predicates in its argument list to change their behaviour based on their qualification.

There are some more Examples.


© Andreas Kupries
Last update at Thu Nov 11 21:48:40 MET 1999