我是 Perl 的新手,我正在研究 CGI 程序。
我尝试了Perl Monks的以下内容,它可以工作。但我不知道它做了什么。
1) 是什么END_HERE
?紧随其后的是HTML
?:
print <<END_HERE;
<html>
<head>
<title>My First CGI Script</title>
</head>
<body bgcolor="#FFFFCC">
<h1>This is a pretty lame Web page</h1>
<p>Who is this Ovid guy, anyway?</p>
</body>
</html>
END_HERE
2)我通过添加修改了示例脚本:
my $query = new CGI;
my $p= $query->param('myparam');
即新脚本是:
#!C:\perl\bin\perl.exe -wT
use strict;
use CGI;
my $query = new CGI;
print $query->header( "text/html" );
my $time = $query->param('fromDate');
print <<END_HERE;
<html>
<head>
<title>My First CGI Script $time</title>
</head>
<body bgcolor="#FFFFCC">
<h1>This is a pretty lame Web page</h1>
<p>Who is this Ovid guy, anyway?</p>
</body>
</html>
END_HERE
# must have a line after "END_HERE" or Perl won't recognize
# the token
它停止工作。我收到以下错误消息:
Undefined subroutine &main::param called at C:/.../test2.cgi line 10.
如果不是这种方式,如何获取浏览器发送的参数?