【发布时间】:2014-05-22 00:21:31
【问题描述】:
按http://perldoc.perl.org/CGI.html制作元标记,给出如下示例:
print start_html(-head=>meta({-http_equiv => 'Content-Type',-content => 'text/html'}))
但是使用以下代码:
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
my $cgi = new CGI;
$cgi->autoEscape(undef);
$cgi->html({-head=>meta({-http_equiv => 'Content-Type',-content => 'text/html',-charset=>'utf-8'}),-title=>'Test'},$cgi->p('test'));
我收到以下错误:
$ perl test.cgi 未定义的子程序 &main::meta 在 test.cgi 第 8 行调用。
我正在尝试生成以下标签:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
【问题讨论】:
-
请停止使用肮脏的旧 CGI.pm。请改用现代且干净的 Web 引擎,例如 Dancer 或 Mojolicious。