ヒアドキュメント

無知って怖いですね。コメントありがとうございました。

前回の書き直し

#!/usr/bin/perl

print << "EOF"
Content-type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>cgi_hd.cgi</title>
<link rel="shortcut icon" href="favicon.ico">
</head>
<body><h1>CGIのテスト</h1></body>
</html>
EOF

確認

# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /cgi-bin/cgi_hd.cgi HTTP/1.0
HOST: localhost:80

HTTP/1.1 200 OK
Date: Tue, 19 May 2009 16:13:47 GMT
Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch
Content-Length: 322
Connection: close
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>cgi_hd.cgi</title>
<link rel="shortcut icon" href="favicon.ico">
</head>
<body><h1>CGIのテスト</h1></body>
</html>
Connection closed by foreign host.
広告を非表示にする