Per http://perldoc.perl.org/CGI.html to make meta tags, the following example is given:
print start_html(-head=>meta({-http_equiv => 'Content-Type',-content => 'text/html'}))
However using the following code:
#!/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'));
I get the following error:
$ perl test.cgi Undefined subroutine &main::meta called at test.cgi line 8.
I'm trying to generate the following tag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
The meta
sub is not imported automatically when you use CGI;
. Try with
use CGI "meta";
(or ":all"
).