每个HTML都需要一个HTML Header, 如果是HTML文本文件, Webserver会自动加一个, 如果是CGI程序, 你需要自己加. 不过大家一般用CGI.pm.
试一下这个:
test.htm:
<HTML>
<HEAD><TITLE>Test Perl Program</TITLE></HEAD>
<BODY>
<H2>This is a Perl test program.</H2>
<a href="http://superman/cgi-bin/test.pl">Test App </a>
</BODY>
</HTML>
test.pl:
print "Content-Type: text/html\n\n",
"<HTML><HEAD>",
"<TITLE>Perl Program: test.pl</TITLE>",
"</HEAD>",
"Welcome!",
"</BODY>",
"</HTML>";
如果用CGI.pm:
test.pl:
use strict;
use CGI;
my $cgi = CGI->new;
print $cgi->header(),
$cgi->start_html(-title=>"Perl CGI Program: Test.pl"),
$cgi->b("Welcome!"),
$cgi->end_html();
参照一下ActivePerl的CGI的手册。
第一次回答问题,献丑了!
Hunter
试一下这个:
test.htm:
<HTML>
<HEAD><TITLE>Test Perl Program</TITLE></HEAD>
<BODY>
<H2>This is a Perl test program.</H2>
<a href="http://superman/cgi-bin/test.pl">Test App </a>
</BODY>
</HTML>
test.pl:
print "Content-Type: text/html\n\n",
"<HTML><HEAD>",
"<TITLE>Perl Program: test.pl</TITLE>",
"</HEAD>",
"Welcome!",
"</BODY>",
"</HTML>";
如果用CGI.pm:
test.pl:
use strict;
use CGI;
my $cgi = CGI->new;
print $cgi->header(),
$cgi->start_html(-title=>"Perl CGI Program: Test.pl"),
$cgi->b("Welcome!"),
$cgi->end_html();
参照一下ActivePerl的CGI的手册。
第一次回答问题,献丑了!
Hunter