Comments on: First R3 CGI script
As a simple test of progress on R3 development, I wrote a small CGI script for this Linux server.
Since R3 does not contain a special CGI startup mode (no -c option), I added a short loop to obtain the CGI environment variables. And, it only needs to request the variables that the script actually needs.
Here's the example script:
REBOL [Title: "R3 CGI Env Test"]
print "Content-type: text/html^/"
cgi-env: object [
foreach word words-of cgi-env [
str: uppercase to-string word
replace str #"-" #"_"
if val: get-env str [set in cgi-env word val]
print ajoin [
<link rel='stylesheet' href='http://www.rebol.com/styles-dev.css'>
<h1> "R3 CGI Test" </h1>
<p> "Date:" now </p>
<p> "Vers:" system/version </p>
<pre> cgi-env </pre>
So, if you want to see other CGI variables, just add another word to the cgi-env object.
Try it out: R3 CGI Test
Now that R3 has modules, it would be good to add a small CGI support module (as a built-in) that provides some of the main functions most users want from CGI. We've already created most of these for R2, and I think they will work in R3 with minor changes. It would be useful to provide them as a standard module.
Post a Comment:
You can post a comment here. Keep it on-topic.