Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: always logged in with CGI::Session

by bibliophile (Parson)
on Mar 24, 2006 at 15:31 UTC ( #539048=note: print w/ replies, xml ) Need Help??


in reply to always logged in with CGI::Session

Hi boboson, I'm just figuring out CGI::Session myself...
I think you have a typo - $session->expires shouldn't have the 's', according to the docs: CGI::Session

I'd think that you would want to expire the session after a shorter period of inactivity....?

Update: There's a section on this in the tutorial.

Hope that helps :-)

Further update: I'm wondering about something... does your module always give the session(s) the same session id? I admit that I haven't played with CGI::Session->name()... :-/

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


Comment on Re: always logged in with CGI::Session
Re^2: always logged in with CGI::Session
by boboson (Monk) on Mar 24, 2006 at 19:32 UTC
    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?
      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(); }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (21)
As of 2014-09-17 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (79 votes), past polls