在设置好IIS后,写下第一个CGI程序:
#! D:\Perl\bin\perl -w print "Content-type: text/html\n\n"; print <<END_OF_HTML; <HTML> <HEAD> <TITLE>About this server</TITLE> </HEAD> <BODY> Servername: </BODY> </HTML> END_OF_HTML
这时候,键入http://localhost/cgi/first.cgi却总是显示下列错误:
CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: Can't find string terminator "END_OF_HTML" anywhere before EOF at ~\cgi\first.cgi line ~.
解决方法:最后一行的END_OF_MAIL后面加上一个换行符,因为Perl总是匹配\nEOF\n
#WTF....