I am trying to create the meta tag:

<META HTTP-EQUIV="Pragma" CONTENT="no cache">

I tried the following line:

print $cgi->start_html(-title => 'Meta Test', -meta=> { 'HTTP-EQUIV'=>'Pragma', 'CONTENT'=>'no cache'}), "\n";

But I get this:

<meta name="HTTP-EQUIV" content="Pragma" /> 
<meta name="CONTENT" content="no cache" />

Can someone tell me how to create the right tag using CGI?

Recommended Answers

All 3 Replies

Ok, I got it to work:

print $cgi->start_html(-title => 'Siddharth\'s Search Engine', -head => "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no cache\" />"), "\n";

Although, I would still like it more if there was a better way to do it.

Ok, I got it to work:

print $cgi->start_html(-title => 'Siddharth\'s Search Engine', -head => "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no cache\" />"), "\n";

Although, I would still like it more if there was a better way to do it.

Its covered in the CGI modules documentation, you were pretty close actually:

use CGI;
my $cgi = CGI->new;
print $cgi->start_html(-title => 'Meta Test',
                       -head=>$cgi->meta({-http_equiv => 'Pragma',
                                          -content    => 'no-cache'}));

lol! Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.