procmail
[Top] [All Lists]

Re: proper way to assign return value to a variable

2010-12-30 10:00:11
Holger,

Thank you very much for your reply.  I really appreciate it.  I see what
your saying about ?.  However, also need the return value so that I can feed
it to another script.

Thanks



2010/12/30 Holger Wahlen <H(_dot_)Wahlen(_at_)gmx(_dot_)de>

* Richard Reina wrote:
:0 w # send to test_subject.pl check for order no.
* ? /usr/bin/perl -e 'require "/home/richard/.pmdir/test_subject.pl";
test_subject($ENV{SUBJECT};'

This works fine, but what I need is to capture the return value of the
script so that I can compare it in a conditional and depending on the
result
use it in another called script.

Actually "?" conditions make it even easier to do what you want, you
don't need to capture the return value yourself and compare it to 0
explicitly in later recipes: if you add an action line to your recipe,
this action will only be executed if the script returns 0, and you can
add another recipe with an "E" flag to deal with the "else" case.

:0
* ? your_perl_script
| pipe_to_execute_if_script_returns_0

:0 E
| pipe_to_execute_if_script_returns_something_else

/HW
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail