http://www.perlmonks.org?node_id=539080


in reply to Re: always logged in with CGI::Session
in thread always logged in with CGI::Session

Yep, your'e right the (s) shouldn't be there. However it still works with the (s)??? Don't ask me why!
I read in a post doing a supersearch that if you don't supply the expire, the session would expire when the browser window is closed. This doesn't seem to be true, or it is true and my application always gives me the same sessionid.
It sure feels like it always gives me the same session id. I use the name() function to shorten the "CGISESSID" name variable to just "sid", because if a user doesn't have cookies activated I can send the sessionid with a name of my choice like this:
# get sessionid for querystring if ($q->cookie('sid') ne $session->id()) { $tmpl->param(sid => "&sid=".$session->id()); }
Do you have any clue how to prevent the same sessionid to be set?

Replies are listed 'Best First'.
Re^3: always logged in with CGI::Session
by bibliophile (Prior) on Apr 03, 2006 at 16:15 UTC
    Sorry, I've been out of the office for the last week :-)

    I'm only guessing here... but take a look at: session_config. Maybe you want to use that in your init_session routine, rather than using CGI::Session->name()?

    Let me know if that changes anything - I'm quite curious (as I'll be needing something like this myself in a while!)

    -bib

    -- WARNING: You are logged into reality as root.
      I am not sure yet, haven't done to much testing. But it seems to work. I removed the name and the session header calls.
      sub init_session { # application object my $self = shift; my $name = shift; # change name from CGISESSID to shorter sid #CGI::Session->name($name); # init session object using CGI::Application::Plugin::Session my $session = $self->session; # send session to header #$session->header(); }
        Interesting. It might be worth asking the author of C::A::Plugin::Session about that.

        -Bib

        -- WARNING: You are logged into reality as root.