Hi: I am asking here as a last resort. I have this little subroutine that I am trying to recover cookie info to calling routine to determine whether use is logged in. The SID gets stored in the session table each time I log in. Over and over. This subroutine returns 0 on each attempt This warn("GetUserSessionCookie SID: $sid"); posts to error log: GetUserSessionCookie sessionname: '' at /home/jalamior/www/httpsdocs/cgi-bin/lib/perl/manageusers.pm line 673. I have seen fetch two different ways in literature CGI::Cookie->fetch. and fetch CGI::Cookie; ?????? Neither seems to work Since my $sessionname = 'CGISESSID'; is defined as global in the module, I am assuming that this code will recover only the cookie info associated with that name. Brain dead. Thanks
sub GetUserSessionCookie { warn("Entered GetUserSessionCookie"); use CGI qw/:standard/; # fetch existing cookies my %cookies = CGI::Cookie->fetch; warn(%cookies); my $sid; # warn("GetUserSessionCookie sessionname: '$cookies{$sessionname}'" +); if ($cookies{$sessionname}) { $sid = $cookies{$sessionname}->value; warn("GetUserSessionCookie SID: $sid"); } else{ $sid = 0; } return $sid; }
In reply to Cookie->fetch problem by tultalk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |