print "$cookie\n"; print "Content-type: text/html\n\n"; print "Have we a cookie?????\n";
If you mean you can't see the actual cookie printed it is because you print it before sending content-type headers... Try moving all print statements you want to appear on your browser after printing content-type headers. And btw that \n\n should have been \r\n or more accurately:
... For example, most networking protocols expect and prefer a CR+LF ("\015\012" or "\cM\cJ" )
It is for these trivial mistakes that CGI can save you a lot of trouble if not time. Here is how to set a cookie on client's browser:
use CGI; my $cgi = CGI->new; my $cookie = $cgi->cookie(-name => 'CookieName', -value => 'CookieVal +ue' ...); print $cgi->header( -cookie => $cookie, -type => 'text/html'); #print "just set a cookie on you<br>" print $cgi->start_html("just set a cookie on you<br>");
In reply to Re^3: searching for small Cookies example but found does not work
by bliako
in thread searching for small Cookies example but found does not work
by toohoo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |