Reputation: 114
I am trying to create a new session with the CGI::Session module.
$session = new CGI::Session("driver:file", undef, {Directory=>'/tmp'});
$sid = $session->id;
But it returns [error] Can't call method "id" on an undefined value at /home/httpd/cgi-bin/login.cgi line 74, line 36.,
It seems that the new session returns null. It doesn't seem to create any new files in the tmp folder, too. What could be the problem? Maybe the library is not installed correctly?
Upvotes: 0
Views: 462
Reputation: 2791
Extract from the docs:
new()
Returns new session object, or undef on failure. Error message is accessible through errstr() - class method.
So you might want to check for something like this:
my $session = CGI::Session->new or die CGI::Session->errstr;
Upvotes: 2