问题
I have tried without success setting cookies using Perl CGI.
My code looks like this:
$qry = new CGI
$cookie = $qry->cookie(-name=>'SERVER_COOKIE',
-value=>'USER_NAME',
-path=>'/'),
$qry->header(-cookie=>$cookie)
The page does not throw any error, but no cookie gets set!
I am using Firefox 3.5.5 with the add-on to view cookies.
What am i doing wrong?
Gath
回答1:
If your missing semicolons are just an artifact of pasting your question, the key point here is that you need to print
the call to header
for it to get sent to the browser.
print $qry->header(-cookie=>$cookie);
来源:https://stackoverflow.com/questions/1790194/how-do-i-set-cookies-using-perl-cgi