script1.pl use CGI; use CGI::Carp qw/fatalsToBrowser warningsToBrowser/; use CGI::Session ( '-ip_match' ); my $session = CGI::Session->new(); $session->param("TestName", "TestValue"); $session->flush(); print $session->header(-location=>'test.pl'); script2.pl use CGI; use CGI::Carp qw/fatalsToBrowser warningsToBrowser/; use CGI::Session ( '-ip_match' ); my $session = CGI::Session->load() or die CGI::Session->errstr(); print $session->id . " - " . $session->param('TestName');
After script1.pl executes, I see the cookie in my browser with the CGISESSID parameter and the session ID as the value.
Looking at network traces, I see the "Cookie: CGISESSID=e3b27743bdd22a2d446abb1f9454a721\r\n" begin passed in the header data.
On the server I see the "cgisess_e3b27743bdd22a2d446abb1f9454a721" session file created in the system temp directory. Opening the session file on the server with notepad shows the (TestName and TestValue)'s are stored in the session file.
But when script2.pl tries to load the session, I get nothing. No session ID, no parameters. The result script2.pl that is displayed in the browser is a hyphen ( - ), due to print being fed the " - " string literal.
I've even tried changing CGI::Session->load() in script2.pl to CGI::Session->new(), however, this only results in returning a brand new session. Opening the new session file from the temp directory shows the "TestName" and "TestValue" do not exist.
Seeking enlightenment.
In reply to Loading a session from CGI::Session by SitrucHtims
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |