What you really want to do is to write a module for Apache for embedding GNU APL. This way you'll have a much cleaner interface,and performance will be better too.
The way this is done is documented here: http://httpd.apache.org/docs/2.4/developer/modguide.html On 30 Sep 2015 03:49, "Juergen Sauermann" <[email protected]> wrote: > Hi Alex, > > I believe GNU APL is keeping a list of files that are read one after the > other. > When you start GNU APL from a script then that script is read first and > the next > file (*stdin* from the *CGI*) is read after that. At least that is the > plan. > > So if you read from *stdin* using *FILE_IO* then you probably get the > next lines in > the script file (which is probably not what you wanted). > > I guess what you want in the *CGI* case is a script that defines APL > functions and variables, > possibly using *)COPY*. Then, on the last line of the script, call a > function which then > hopefully gets the content of the next file (=*stdin* from *CGI*). This > case was never tested, though. > > /// Jürgen > > > On 09/29/2015 02:41 AM, [email protected] wrote: > > Jürgen, > > Given this behavior, how is it possible to read from stdin of the CGI > script with FILE_IO for the input on the first line, because wouldn't you > have to )COPY in FILE_IO on the ⎕LC-1 line? > > -------- Original Message -------- > Subject: Re: [Bug-apl] related to ⎕QS > From: Juergen Sauermann <[email protected]> > Date: Sun, September 27, 2015 7:59 am > To: [email protected], [email protected] > > Hi Alex, > > yes. You echo "yadda" into the interpreter. > > From the interpreter's perspective this means that you first enter a line > containing the word yadda, which leads to a VALUE ERROR because the > interpreter tries to reference a variable with that name. Same as the > following > when entered directly: > > yadda > VALUE ERROR > yadda > ^ > > Then you close stdin and the interpreter complains. > > ^D or end-of-input detected (1). Use )OFF to leave APL! > > The reason is the following. Normally the stdin of a process is closed by > typing ^D. > However, just exiting on ^D would make you loose your work. The APL > interpreter therefore > tells you to give command )OFF instead, which is the standard way of > ending an APL session. > > This is fine if you run apl interactively. However, if you run it as a > script (like in your echo example), > then this would lead to an infinite loop. Therefore > > (1) the warning is printed only a few times, and > (2) when EOF (aka ^D) is still coming in (and at a fast rate) > > then the interpreter assumes that it is run from a script and exits > without )OFF. > > /// Jürgen > > > On 09/26/2015 12:36 AM, [email protected] wrote: > > Jürgen , > > You mentioned: > as far as I remember the POST'ed data can be read from stdin of the CGI > script. So probably FILE_IO (read() or fgets()) may do the job. > > I'm a bit confused. I was messing around with this and ran the following > on the command line to see where stdin is going: > echo "yadda" | apl > > The results are unexpected (at least to me). It looks like APL is > evaluating yadda as a variable. I might have expected that it appear as a > string, so that I could read it in and store it (but I'm not sure that is > even the right thing to do). > Then this prints: > ^D or end-of-input detected (1). Use )OFF to leave APL! > > > ^D or end-of-input detected (2). Use )OFF to leave APL! > > > ^D or end-of-input detected (3). Use )OFF to leave APL! > > > ^D or end-of-input detected (4). Use )OFF to leave APL! > > Then this prints: > *** end of input > > and then the interpreter exits. Can this behavior be explained? > > -Alex > > > >
