954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Unable to create no-cache meta tag with CGI

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?

sid78669
Junior Poster
198 posts since Nov 2008
Reputation Points: 10
Solved Threads: 8
 

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.

sid78669
Junior Poster
198 posts since Nov 2008
Reputation Points: 10
Solved Threads: 8
 

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'}));
KevinADC
Posting Shark
921 posts since Mar 2006
Reputation Points: 246
Solved Threads: 67
 

lol! Thanks!

sid78669
Junior Poster
198 posts since Nov 2008
Reputation Points: 10
Solved Threads: 8
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You