What I want to do is to write to a session variable, but looking at documentation for CGI, i don't see that as an option. I do see HTTP Cookies, so per-session cookie is my next alternative, but still no luck at all. Problem is
1) How do I make the cookie per-session (i.e. not stored in browser)
2) using the following code, nothing is working!
It is not storing or picking up the cookie value!!
1) How do I make the cookie per-session (i.e. not stored in browser)
2) using the following code, nothing is working!
It is not storing or picking up the cookie value!!
Code:
#!/usr/bin/perl -w
use CGI qw(:standard);
$query=new CGI;
$cookieValue = $query->cookie("test") || 999;
$cookieValue++;
$packedCookie = $query->cookie(-NAME => 'test',
-VALUE => $cookieValue,
-EXPIRES => '+1h',
-path => '/cgi-bin',
-domain => '.myWebsite.com');
print $query->header(-type=>'text/html',
-cache_control => 'no-cache',
-expires=>'now',
-COOKIE => $packedCookie);
print "<HTML><HEAD><TITLE>Session Cookie Test</TITLE>";
print "<meta name=\"Pragma\" content=\"no-cache\">";
print "<meta name=\"Cache-Control\" content=\"no-cache, must-revalidate\">";
print "<meta name=\"Cache-Control\" content=\"no-cache, must-revalidate\">";
print "<meta name=\"Expires\" content=\"Thu, 1 Jan 1970 00:00:01 GMT\">";
print "</HEAD><BODY>";
print "cookie value is [";
print $cookieValue;
print "]<br>";
print "</body></html>"