A trick with perl
Andrew Pimlott
andrew at pimlott.net
Sun Jan 4 06:02:54 CET 2004
On Sat, Jan 03, 2004 at 04:51:09PM -0800, Chris Fortune wrote:
> # Loop for each email
> open NP, ">$RAM_file.FIFO" or die $!;
> print NP "$head\n$body\n^D"; # ^D is EOF, just in case
> close NP;
You're heading for headaches because a pipe can only buffer so much
input, so your program will hand when you have a long message.
Using Open2 has the same problem. The simplest solution is to use a
temporary file at one end:
open FILTER, "| prog > result";
print FILTER "$head\n\n$body";
close FILTER;
open RESULT, "<result";
Also, that ^D is bogus. ^D only means end of file when pressed in a
terminal; it does not appear in the file stream and can only confuse
the filter.
Andrew
More information about the Bogofilter
mailing list