From: Mary Ellen Foster
Subject: Communicating with a perl script from ACL 4.3
Date: 
Message-ID: <EApA38.K9x@undergrad.math.uwaterloo.ca>
As part of a Web application, I need to call a Perl script from within ACL
4.3 on a Unix machine. This seems to be mostly working, except when I try
to write directly to the STDIN of the perl program rather than redirecting
a file into it.

Basically, what happens is that I do the (excl:run-shell-command) call with
the name of the Perl script as the program to run, with both input and
output as :stream. I can write to the resulting stream fine, but whenever I
try to read from the same stream, it hangs. If I use a pre-existing file as
the input, I can read from the output stream no problem. If I substitute a
Unix system call like "cat" instead of the Perl program, I can communicate
with it no problem.

Has anyone done this and made it work? Any pointers?

Thanks,

MEF

-- 
|. Mary Ellen Foster .||. http://www.csclub.uwaterloo.ca/u/mefoster/ .|
"Life... is like a box of chocolates. A cheap, thoughtless, perfunctory
 gift that no one ever asks for. Unreturnable because all you get back 
 is another box of chocolates." -- Musings of a Cigarette Smoking Man

From: Rob Malouf
Subject: Re: Communicating with a perl script from ACL 4.3
Date: 
Message-ID: <5m81ss$a5h@cardinal1.Stanford.EDU>
In article <··········@undergrad.math.uwaterloo.ca>,
Mary Ellen Foster <···············@calum.csclub.uwaterloo.ca> wrote:
>                   I can write to the resulting stream fine, but whenever I
>try to read from the same stream, it hangs. If I use a pre-existing file as
>the input, I can read from the output stream no problem.

I had a similar problem, which I finally solved by adding this line to
the Perl program:

	$| = 1;

This tells Perl to perform all outputs immediately.  Normally, Perl
buffers its output, so there's no way to know when the Perl script's
output will be available for input.

If you get fed up with Perl, you might also want to take a look at
cl-http (a web server written in Common Lisp). 

Rob Malouf
······@stanford.edu
From: Mary Ellen Foster
Subject: Re: Communicating with a perl script from ACL 4.3
Date: 
Message-ID: <EAroDn.DAw@undergrad.math.uwaterloo.ca>
In article <··········@cardinal1.Stanford.EDU>,
Rob Malouf <······@leland.Stanford.EDU> wrote:
>I had a similar problem, which I finally solved by adding this line to
>the Perl program:
>
>	$| = 1;

THANK YOU! This worked exactly as desired... I had a feeling it was maybe
something like that.

>If you get fed up with Perl, you might also want to take a look at
>cl-http (a web server written in Common Lisp). 

Yeah, I've been using cl-http, but I had this text-formatting script
written in perl that it seemed easier just to call from within lisp than to
rewrite entirely. I'll probably eventually rewrite the whole thing in lisp,
but for now, it's working...

Thanks again,

MEF

-- 
|. Mary Ellen Foster .||. http://www.csclub.uwaterloo.ca/u/mefoster/ .|
"Life... is like a box of chocolates. A cheap, thoughtless, perfunctory
 gift that no one ever asks for. Unreturnable because all you get back 
 is another box of chocolates." -- Musings of a Cigarette Smoking Man