comgt
cee oh em gee tee - "commgitt"
Login to access.
User: pw: ?

CGI

Common Gateway Interface

Back-end, web server, technology.

printenv.pl:

#!/usr/local/bin/perl -wT

use strict;
use diagnostics;

$|++;

print "Content-Type: text/html\n\n";
print "<HTML><HEAD><TITLE>Printenv Script</TITLE></HEAD>\n";
print "<BODY>\n";
print map { "<P><B>$_</B> = $ENV{$_}</P>\n" } sort keys %ENV;
print "</BODY></HTML>\n";

$$$. dd

ddd

Results from another printenv script, as static text, actual execution - only works if server is configured accordingly (not on Internet): http://localhost:8888/cgi-bin/printenv.

 

400 Bad Request

500 Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.

A Mac-encoded text file - uses CR for line breaks
cmdprompt> less printenv.cgi
#!/usr/local/bin/perl -wT^M^Muse strict;^Muse diagnostics;^M^M$|++;^M^Mprint "Co
ntent-Type: text/html\n\n";^Mprint "<HTML><HEAD><TITLE>Printenv Script</TITLE></
HEAD>\n";^Mprint "<BODY>\n";^Mprint map { "<P><B>$_</B> = $ENV{$_}</P>\n" } sort
keys %ENV;^Mprint "</BODY></HTML>\n";
A UNIX (and DOS)-encoded text file - uses LF for line breaks
cmdprompt> less printenv.pl 
#!/usr/local/bin/perl -wT
use strict;
use diagnostics;
$|++;
print "Content-Type: text/html\n\n";
print "<HTML><HEAD><TITLE>Printenv Script</TITLE></HEAD>\n";
print "<BODY>\n";
print map { "<P><B>$_</B> = $ENV{$_}</P>\n" } sort keys %ENV;
print "</BODY></HTML>\n";
[johan@jp2] comgt/search> 	

 

Updated 2008-08-25