I am trying to use it in a CGI script and get the entire CGI environment. The above works, but it gives me the shell environment variables. Two different things.

My understanding is that with CGI all the parameters are only available to the process as environment variables. I googled a BASH script and a Perl script, and then compared with the simple GST script below. When run on Linux I can extract the same information with all three scripts. Are you getting different results on your platform?

--------------------------
PERL demo CGI script
#!/usr/bin/perl
##
##  printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/plain\n\n";
foreach $var (sort(keys(%ENV))) {
   $val = $ENV{$var};
   $val =~ s|\n|\\n|g;
   $val =~ s|"|\\"|g;
   print "${var}=\"${val}\"\n";
}

--------------------
GST demo CGI script

#!/usr/local/bin/gst -f

Transcript showCr: 'Content-type: text/plain'; nl.

cgivars := {'SERVER_SOFTWARE'. 'HTTP_ACCEPT'. 'HTTP_HOST'. 'REQUEST_URI' }.
cgivars do: [ :env |
   Transcript showCr: env,':',(Smalltalk getenv: env)].

Transcript nl; showCr: '==== All Env Vars below ==============';nl.
pipe := FileStream popen: ('set',logFile) dir: FileStream read.
Transcript showCr: pipe contents.
! !

Regards
Stephen




_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to