procmail
[Top] [All Lists]

Re: Piping From Line to PERL Script

1997-11-24 10:35:55
Liston Bias wrote:

Can someone tell how to pipe FROM Line through a Perl Script? 
...
 The verbose log says it
is executing filename but nothing is ever written.

... [ 19 lines of variously nested stuff from .procmailrc] ...

       :0 fbw
       | /home/e43/booboo/test.pl {$MATCH}

Your set of regex's or your perl program isn't working.
 :( Or maybe both of them :)

You can separate the two problems for faster debugging -
eg, use simple regex's while debugging the perl program,
and vice versa.  

As an example, the following works to copy message to file via a perl
program.
---------------in  .procmailrc----------
:0
* ^From:[         ]*\/[^  ].*
|$HOME/.formail/liston.pl

---------------in liston.pl ----------
#!/usr/bin/perl
open (ITEM, ">rc-liston.out-1");
for (<>) { print ITEM "1 says: ";  print ITEM; $lines++; }
close ITEM;
print " 1: Wrote $lines lines ";
---------------------------------------

With the above, the verbose log said, in part,
  procmail: Executing "/home/j-waldby/.formail/liston.pl"
and the rc-liston.out-1 file collected stuff like
  1 says: From - Sun Nov 10 20:37:22 1996
  1 says: From:  "Jo Joe" <whoops(_at_)tiddly(_dot_)gov>
...
  1 says:  L3
  1 says:  L4
...

For the perl program shown, if you replace action line 
  |$HOME/.formail/liston.pl
by
  LOG=|$HOME/.formail/liston.pl
you should see a line like
   1: Wrote 29 lines 
in the logfile, ie, the stdout output of the perl program.

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