Re: [exim] pipe to bounce parser help

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Phil Pennock
Fecha:  
A: Robert Van Horn
Cc: exim-users
Asunto: Re: [exim] pipe to bounce parser help
On 2007-12-20 at 13:49 -0800, Robert Van Horn wrote:
> The parser just opens the mail and an output file for the report
> then runs bounce_parser on it - closes the files - quits.
> My tests so far have been in the form of ./bpt.pl testmail.doc.
> With the existing file in the same dir there is no existential
> question - however when an email appears and runs through the
> script - then how do I handle that?


The mail is provided on the script's standard input. You'll need to
read up on stdio, redirections and pipes for background material, but
pipes are integral to the power and success of Unix, which introduced
them. This is why the Exim transport is called "pipe".

In Perl, <STDIN> reads from stdin, or you can use the special <>
operator like this:

while (<>) {
whatever
}

which reads each file named on the command-line or, if no files, reads
from stdin -- that will get you close to the "traditional" way for
commands which take optional command-line parameters. See
"perldoc perlop" under "I/O Operators".

Also, given the output you provided, you probably want to make sure that
your Perl script is exiting 0, otherwise Exim will think that the piped
command has failed.

Regards,
-Phil