http://www.perlmonks.org?node_id=466511


in reply to Re: Concern with CGI::Session
in thread Concern with CGI::Session

i have some queries
i have set session id and domain name in the cookies which are sent to the user browser
$cookie =$cgi->cookie( -CGISESSID => $session->id, -expires => '+1h', -domain => 'B2R6A056a' }; print $cgi->header(-cookie=>$cookie);
now when the user clicks a tab and goes to another page i want to fetch the cookie from the usersession and then intially trying to print all the values got from the cookie
my %cookie = fetch CGI::Cookie; foreach $keys ( sort keys %cookie) { print "$keys : $cookies{$_}"; }
but i am not able to fetch the cookie
is there some problem in the line of my thinking
or is there something more i have to take care of
please advice

Replies are listed 'Best First'.
Re^3: Concern with CGI::Session
by cees (Curate) on Jun 14, 2005 at 14:10 UTC

    The -domain part of a cookie should be the domain name of the server(s) that you want to receive the cookie (1). 'B2R6A056a' does not look like a valid domain name to me, and that is probably causing your problem.

    My suggestion would be to simplify things by removing the -expires and -domain part of the cookie, and seeing if that works. If it does work, then add one of the options back in ans see if things still work. Simplifying things and taking it one step at a time is a very successful debugging tool that is useful when you are not sure what is causing your problems.

    If that doesn't work, then you need to start looking carefully at the actual headers being sent along with the request (that includes client headers and server headers). Mozilla can be helpful with this, since it has plugins to debug client and server HTTP headers. Look for the Set-Cookie: header in the server headers, and Cookie: header in the client headers.

    (1) http://wp.netscape.com/newsref/std/cookie_spec.html