Steny has asked for the wisdom of the Perl Monks concerning the following question:
As you can see, I want to use the contents of a variable as the name of the variable that will store the sessionID in the cookie.my $var = 'test'; my $session = new CGI::Session("driver:File", undef, {Directory=>" +/tmp"}); $session->param("display_name", $display_name); $session->param("access_level", $access_level); $session->param("site_name", $site_name); $session->param("user_id", $user_id); $session->param("signature", $signature); $session->param('+18h'); my $cookie = $foo->cookie($var => $session->id); print $foo->header( -cookie=>$cookie );
With the print statement, I get:my $sid = $foo->param('test'); my $session = new CGI::Session(undef, $sid, {Directory=>'/tmp'}); my $access_level = $session->param("access_level") || 0; my $display_name = $session->param("display_name") || ""; my $user_id = $session->param("user_id") || 0; print "Sid: $sid<BR> Session: $session<BR> Access: $access_level<BR> Name: $display_name<BR> User ID: $user_id<BR>\n";
When I do the same test on my website (exact same script) it works fine. The appropriate access, name, and User ID are printed. I'm completely stumped to why this isn't working on my machine.Sid: bab864bfd5e46898b2252e19cffdf038 Session: CGI::Session::File=HASH(0x1bc0680) Access: 0 Name: User ID: 0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI::Session - Problems creating session...
by cees (Curate) on May 02, 2003 at 04:17 UTC | |
by Steny (Sexton) on May 02, 2003 at 04:25 UTC | |
by jgallagher (Pilgrim) on May 02, 2003 at 05:59 UTC | |
by PodMaster (Abbot) on May 02, 2003 at 14:09 UTC |