A trick with perl

Tom Anderson tanderso at oac-design.com
Mon Jan 5 15:26:49 CET 2004


On Sun, 2004-01-04 at 17:46, Chris Fortune wrote:
> 'email.txt' can be input on STDIN to several different programs, which all
> output to STDOUT, and to do it with minimal (or no) disc access.  If anyone
> has other perl-ish ideas, please post them.*

What was the problem using Open2?  I suggest fixing that bug.  It works
fine for me...

use IPC::Open2;
my $pid = open2(\*R,\*W,"bogofilter $options") or error("die","Could not
open pipe to bogofilter: $!");
syswrite W, $email or error("die","Cannot write to pipe: $!");
if (close W) {sysread R, $output, 32 or error("warn","Cannot read from
pipe: $!");}
waitpid $pid, 0;

For my full code, see: http://www.orderamidchaos.com/bogofilter/bfproxy

Tom

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.bogofilter.org/pipermail/bogofilter/attachments/20040105/d0132a35/attachment.sig>


More information about the Bogofilter mailing list