Click here to get back home

Problems with CGI::Session in Perl

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Problems with CGI::Session in Perl David Staschover 08-08-2005
Posted by David Staschover on August 8, 2005, 11:25 am
Please log in for more thread options


Hi,

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!

Thanks,

- David

session1.cgi:
#!/usr/bin/perl
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 );
$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,);
print "Original Session ID is $sid<br>";
$sid = $session->id();
print "New Session ID $sid<br>";
exit;






Posted by xhoster on August 9, 2005, 12:15 am
Please log in for more thread options


> Hi,
>
> 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.

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

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

Xho

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


Similar ThreadsPosted
encapsulation of session/secure login: looking for perl mod September 29, 2004, 7:29 am
perl cgi session module installation problem June 5, 2006, 11:11 am
Perl module for cookie/logon/session management with Apache May 10, 2007, 12:40 pm
CGI::Session::MembersArea V 2.01 July 29, 2004, 7:14 am
CGI::Session::ExpireSessions V 1.03 July 29, 2004, 7:14 am
Announce: CGI::Session::ExpireSessions V 1.04 November 16, 2004, 10:27 am
ANNOUNCE: CGI::Session::ExpireSessions V 1.06 April 4, 2006, 7:06 pm
ANNOUNCE: CGI::Session::ExpireSessions V 1.08 June 11, 2006, 10:19 pm
Extract Session Cookie February 23, 2007, 3:29 am
problems using Net::SSH::Perl in a while loop April 29, 2005, 10:09 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap