Having trouble with CGI::Sessions
- From: "David Staschover" <davezx1@xxxxxxxxx>
- Date: Wed, 3 Aug 2005 17:36:58 -0400
I'm trying to set up sessions in perl.
The session is initialized fine in session1.cgi
In session2.cgi, the correct session id is returned from the cookie, but
when I initialize the session, a new session is created. The original and
new session id don't match.
Any help would be appreciated!
Thanks,
David
session1.cgi:
#!/usr/bin/perl
use CGI::Session;
use CGI;
$cgi = new CGI;
$session = new CGI::Session(undef,undef,{Directory=>'/tmp/sessions'});
$cookie = $cgi->cookie(CGISESSID => $session->id);
print $cgi->header( -cookie=>$cookie );
$sid=$session->id;
print "Session ID is $sid<br>";
print '<a href="session2.cgi">Link to session2.cgi</a>';
exit;
session2.cgi
#!/usr/bin/perl
print "Content-type: text/html\n\n";
use CGI::Session;
use CGI;
$cgi = new CGI;
$sid=$cgi->cookie("CGISESSID");
$session = new CGI::Session(undef,$sid,{Directory=>'/tmp/sessions'});
print "Original Session ID is $sid<br>";
$sid = $session->id();
print "New Session ID $sid<br>";
exit;
.
- Prev by Date: Re: Running a Perl script from another Perl script
- Next by Date: newbie to perl
- Previous by thread: Running a Perl script from another Perl script
- Next by thread: newbie to perl
- Index(es):
Relevant Pages
|
|