Problems with CGI::Session in Perl

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I'm trying to set up sessions in perl.

session1.cgi defines a new session and sets a cookie. In session2.cgi, the
correct session id is returned from the cookie, but when I initialize the
session, a new session is created.

The example is below. Any help would be appreciated!


- David

use CGI::Session;
use CGI;
$cgi = new CGI;
$session = new CGI::Session(undef,undef,);
$cookie = $cgi->cookie(CGISESSID => $session->id);
print $cgi->header( -cookie=>$cookie );
print "Session ID is $sid<br>";
print '<a href="session2.cgi">Link to session2.cgi</a>';

print "Content-type: text/html\n\n";
use CGI::Session;
use CGI;
$cgi = new CGI;
$session = new CGI::Session(undef,$sid,);
print "Original Session ID is $sid<br>";
$sid = $session->id();
print "New Session ID $sid<br>";

Re: Problems with CGI::Session in Perl

Quoted text here. Click to load it

Is anything actually getting created in /tmp/sessions/?

If not, check permissions.  CGI::Sessions seems to return successfully
even when it should not.


-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB

Site Timeline