Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I keep getting the error "Can't call method "cookie" on an undefined value" I am not sure if the place that i put the session in my code effects how it runs? I have it stored after the params are read in from the form submitted by the user, but before checks are done to validate those params submitted by the user. Can anybody tell me why this is happening, and where I am going wrong. I would greatly appreciate any help!if($ENV{REQUEST_METHOD} eq 'POST') { $q = new CGI; $username = $q->param('user_name'); $pword = $q->param('pwd'); } my( $session, $query, $cookie, $name, $cgi); #Create a new session $session = new CGI::Session(undef, undef, {Directory=>'./tmp/sessions' +}); #Allow cgi-session read the cookie at the next request $cookie = $query->cookie( -name => $session->name, -value => $session->id ); print $query->header( -cookie=>$cookie); #Store the username in the session $name = $cgi->param($username); $session->param($username, $name); #Check if the username and password match #Do rest of code
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sessions problems
by dorward (Curate) on Dec 13, 2006 at 10:09 UTC | |
|
Re: Sessions problems
by themage (Friar) on Dec 13, 2006 at 10:15 UTC | |
by Anonymous Monk on Dec 13, 2006 at 10:47 UTC | |
by f00li5h (Chaplain) on Dec 13, 2006 at 11:00 UTC | |
by Anonymous Monk on Dec 13, 2006 at 11:18 UTC | |
by f00li5h (Chaplain) on Dec 13, 2006 at 20:57 UTC | |
by Anonymous Monk on Dec 13, 2006 at 11:06 UTC | |
by themage (Friar) on Dec 13, 2006 at 10:52 UTC |