procmail
[Top] [All Lists]

Re: Piping From Line to PERL Script

1997-11-24 09:02:01
On Sun, 23 Nov 1997, Liston Bias wrote:
Can someone tell how to pipe FROM Line through a Perl Script?  I though I
just type the name of script after the pipe symbol, but it doesn't seem to
be working.  The perl script should open a file, find a match, and then
write to another file that a match has occured.  The verbose log says it
is executing filename but nothing is ever written.

Please ignore posting... I did not absolutely reference the file I wanted
to write to.  After changing this, it work fine.  For those that may want
to do this in the future, the coding is as simple as:

---------------- .procmailrc -------------------

SUBJECT=`formail -xSubject:`
FROM=`formail -rt -xTo:`
 
:0 
|/home/username/test.pl ${FROM} ${SUBJECT}

------------------------------------------------

Then you can reference the variable in perl script, using the following:
(NOTE: the subject will only grab the first word)

----------------- test.pl ----------------------

$from = $ARGV[0];
$subject = $ARGV[1];

------------------------------------------------

- Liston


============================================================================
- Liston Bias                       The essence of pleasure is spontaneity.
  Alumnus of Oklahoma State Univ                   -- Germaine Greer
  Alumnus of Florida State Univ     
                                     
  bias(_at_)pobox(_dot_)com
  http://www.pobox.com/~bias
============================================================================

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