procmail
[Top] [All Lists]

proper way to assign return value to a variable

2010-12-30 08:56:38
If anyone could please help me with this I would REALLY, REALLY appreciate
it.  I find procmail very cryptic for me and I am endangering my job by
falling way behind on my other work -- not to mention neglecting my family.
Any help would be greatly appreciated. Currently I have a recipe that calls
a perl script like this:

: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.  Something like the following:

:0
PO=`/usr/bin/perl -e 'require "/home/richard/.pmdir/test_subject.pl";
test_subject($ENV{SUBJECT};'`

:0:
* PO ?? 0  # if PO equals zero. PO is NOT valid
|( formail -rI"From: Responses will be automatically discarded <
gatorreina(_at_)gmail(_dot_)com>"; \
   echo "Your mail has been administratively rejected."; \
   echo "PO is not valid." \
 ) | /usr/sbin/ssmtp -oi -t
:0
{# else PO is valid strip the attachments and file it
| ( ripmime -i -d /home/richard/.pmdir/attachments/  )
| /usr/bin/perl -e 'require "/home/richard/.pmdir/test_subject.pl";
rename_attachments($ENV{PO});'

If anyone could please help me.  I would really, really appreciate it. I'm
in dire straights.

Thank you very much for you consideration.

Richard
____________________________________________________________
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