procmail
[Top] [All Lists]

Re: Procmail and perl revisited

1999-05-06 07:31:17
On 05/06/1999 07:16 -0400, Duncan Hill wrote:
     
     However, I have just realised that if I get 2 mails in the same
     second, I'm up a creek.  Can anyone suggest a better method of what
     I'm trying to do?
     

Modify the perl script to capture stdin and save it to a file before
processing the file.

Alternatively (something I've done), create a simple wrapper shell
script that does something along the lines of:

        #!/bin/ksh
        /bin/cat - >| /tmp/blah.$$
        (${*} /tmp/blah.$$ ; /bin/rm /tmp/blah.$$) &

The basic idea is to save stdin to a temp file with a unique
per-process name (hence using ksh's $$ construct - if you don't
have ksh, there's other ways to accomplish the same end), then
fire up whatever was passed as arguments to the script as
a sub-process, adding the name of the file to it's arguments.
Hence, something like

        :0 b
        * <regexp>
        | wrapper perl foo.pl

Will run foo.pl with the temp file as it's argument.


                                tw


-- 
+--------------------------------------+------------------------------------+
| Tim Walberg                          | Phone:  (847) 632-3407             |
| Motorola CE/ITS                      | Pager:  (800) SKY-TEL2 PIN:1384689 |
| 1475 W Shure Dr. IL75-2H14           | FAX:    (847) 632-5769             |
| Arlington Heights, IL 60004          |                                    |
+--------------------------------------+------------------------------------+
| http://www.cig.mot.com/~walberg      | E-mail: 
walberg(_at_)cig(_dot_)mot(_dot_)com,       |
| http://www.skytel.com/Paging (pager) |         1384689(_at_)skytel(_dot_)com 
(pager) |
+--------------------------------------+------------------------------------+

Attachment: pgpFVN7bvr6XB.pgp
Description: PGP signature

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