@niftyのホームページのCGIについて参考までに。
下記のCGIをパーミッション755で実行します。
----
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "<HTML><HEAD>";
print "<TITLE>Perl Environment</TITLE>\n";
print "</HEAD><BODY><h4>";
print "Perl Environment<br><hr>\n";
print "Perl version = $]<br>\n";
print "OS Name = $^O<br>\n";
print "Library PATH = ",join(";",@INC),"<hr><br><br>\n";
print "Environment Variables<br><hr>\n";
while(($key,$value) = each %ENV){
print "$key = $value<br>\n";
}
print "<hr></h4></BODY></HTML>";
----
出力は、ブラウザの見掛けですけど。
----
Perl Environment
Perl version = 5.00503
OS Name = solaris
Library PATH = /usr/local/lib/perl5/5.00503/sun4-solaris;/usr/local/lib/perl5/5.00503;/usr/local/lib/perl5/site_perl/5.005/sun4-solaris;/usr/local/lib/perl5/site_perl/5.005;.
Environment Variables
SERVER_SOFTWARE = ZWS
DOCUMENT_ROOT = /cgi-bin
GATEWAY_INTERFACE = CGI/1.1
REMOTE_ADDR = 125.0.210.87
SERVER_PROTOCOL = HTTP/1.1
REMOTE_HOST = 125.0.210.87
REQUEST_METHOD = GET
REMOTE_USER =
HTTP_USER_AGENT = Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2) Gecko/20100115 Firefox/3.6 GTB6 (.NET CLR 3.5.30729)
QUERY_STRING =
PATH = /usr/sbin:/usr/bin:/usr/bin:/bin
VSERVER_NAME = FreeCGI2
TZ = Japan
HTTP_CONNECTION = keep-alive
HTTP_ACCEPT = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_LANGUAGE = ja-JP,en-us;q=0.5
AUTH_TYPE = Basic
HTTP_KEEP_ALIVE = 115
HTTP_ACCEPT_ENCODING = gzip,deflate
SCRIPT_FILENAME = /cgi-bin/perl_env.pl
SCRIPT_NAME = /kazuf/perl_env.pl
SERVER_NAME = hpcgi1.nifty.com
HTTP_ACCEPT_CHARSET = Shift_JIS,utf-8;q=0.7,*;q=0.7
REQUEST_URI = /kazuf/perl_env.pl
HTTP_COOKIE = PUSER=AmgWIOFogXwXSpSMguWo7CRUg2iB49Wggf3f39jgzgggg; __utma=24222245.295514266.1265722242.1265722242.1265722242.1; FVFCJC=04964cc1471ea912637a3ca7e5298280094042; __utmz=24222245.1265722242.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=mobile%20point
SERVER_PORT = 80
CONTENT_LENGTH = 0
HTTP_HOST = hpcgi1.nifty.com
SERVER_ADMIN = webmaster@...
----
藤岡 和夫
kazuf@...
日曜プログラマのひとりごと http://homepage1.nifty.com/kazuf/renewal.html