Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: CGI::App session params losing values between redirects

by bradcathey (Prior)
on Feb 28, 2009 at 19:49 UTC ( [id://747198]=note: print w/replies, xml ) Need Help??


in reply to CGI::App session params losing values between redirects

Update: solved

After another very careful reading of the docs and looking at the source code of the plugin, I added the line CGI::Session->name('MY_SESSID'); and voila. Turns out if you change the name of the cookie in your configuration block, you have to let CGI::Session know about it or it creates another cookie/session, wiping out the old one. As soon as I added the line, all was good. I'm curious where it stores the name, because I'm not finding it in the actual /tmp/sessionfile.

package Super; use warnings; use strict; use base 'CGI::Application'; use CGI::Application::Plugin::Redirect; use CGI::Application::Plugin::Session; (my $http_host = $ENV{'HTTP_HOST'}) =~ s/(www.)([a-zA-Z0-9\-\.]+)/$2/ +; $self->session_config( COOKIE_PARAMS => { -name => 'MY_SESSID', -expires => '+8h', -path => '/', -domain => ".".$http_host, }, SEND_COOKIE => 1, ); CGI::Session->name('MY_SESSID'); #Added this line

—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://747198]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-25 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found