The source I just added is
sub readCookies
{
use CGI qw/:standard/;
if (my $time = cookie('WBSession')) {
$testVal = "Cookie Exists";
} else {
$testVal = "Cookie Does Not Exists";
}
return $testVal;
}
And I tried adding the below line to the code existing code.
print "set-cookie: WBSession=$sessionInfo; path=/cgi-bin;\n\n";
print "set-cookie: TestCookie=$testVal; \n\n";//added
Whenever I add this I get the set-cookie: TestCookie=$testVal printed on the top of the screen.
why is it like this ?
| [reply] |
You see those because something has already finished printing headers to the browser. Your print statements print headers; they must come before all other output.
Something somewhere else in your program is printing headers. If you want to set cookies, you'll have to print them wherever that something is in your program. It may be a call to header() or something like print "Content-type: text/html\n\n".
| [reply] [d/l] [select] |