I think you mean CPAN rather than CSPAN.
The first thing to do is:
use strict;
use warnings;
That will catch a number of issues with your code.
I keep getting the error "Can't call method "cookie" on an undefined value"
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 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.
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. |