in reply to Error in my code while set cookie?
The problem is with the $status you passed in, and it is not defined. If you pass in a valid value, the cookie will be generated.
use CGI; use HTTP::Cookies; use Data::Dumper; my $q = new CGI; my $status=$q->cookie('ckname'); &set_cookie('abc'); sub set_cookie { my($cookieid)=shift; my @cookies; push @cookies, $q->cookie(-name=>"ckname", -value=>$cookieid, -expires=>'', -path=>'/', -domain=>'.bn.whsites.net'); print $q->header(-cookie=>\@cookies); }
Thsi gives:
Set-Cookie: ckname=abc; domain=.bn.whsites.net; path=/ Date: Wed, 05 Oct 2005 02:29:51 GMT Content-Type: text/html; charset=ISO-8859-1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Error in my code while set cookie?
by Anonymous Monk on Oct 05, 2005 at 03:05 UTC | |
|
Re^2: Error in my code while set cookie?
by Anonymous Monk on Oct 05, 2005 at 02:35 UTC |