XP is just a number | |
PerlMonks |
Re: Sessions problemsby dorward (Curate) |
on Dec 13, 2006 at 10:09 UTC ( [id://589534]=note: print w/replies, xml ) | Need Help?? |
I think you mean CPAN rather than CSPAN. The first thing to do is:
That will catch a number of issues with your code.
In the line: my( $session, $query, $cookie, $name, $cgi);You create a scalar called "$query", but you don't assign a value to it. By the time you use it two (non-blank, non-comment) line later, you still haven't assigned a value to it. Judging from the methods you are calling on it, I think you want it to be a CGI object. You create one earlier in the script. $q = new CGI;So just reuse that instead of creating another one. (Note that you'll need to move the line, otherwise you'll run into problems since it won't be created if the request isn't POST (there would also be scoping issues if you were following the normal practise of using strict/warnings and scoping the variable with my).
I wouldn't create the session until I knew the credentials were good. That way, if the session exists then you know you've already checked the credentials and you don't need to check them with every single request.
In Section
Seekers of Perl Wisdom
|
|