creating a new session when a session is expired

Discussion in 'Perl Misc' started by alexjaquet@gmail.com, May 17, 2006.

  1. Guest

    Hi,

    After reading the documentation about CGI::Session I didn't find any
    way to create a session when it's expired.

    Now I'm using the following code to create a new session

    local our $session_id=$query->param('session');
    if ($session_id eq '' or $session_id eq '$SESSIONID') {
    $session = new CGI::Session("driver:File", undef,
    {Directory=>"$session_dir"});
    $session->expire(3600);
    $session_id = $session->id();
    }

    how can I extend this piece of code when a session exist but expired ?

    Thanks for your advice.

    Alexandre JAQUET
     
    , May 17, 2006
    #1
    1. Advertising

  2. Guest

    wrote:
    > Hi,
    >
    > After reading the documentation about CGI::Session I didn't find any
    > way to create a session when it's expired.


    docs for new():
    If called with a single argument, it will be treated
    either as $query object, or $sid, depending on its
    type. If argument is a string , "new()" will treat it
    as session id and will attempt to retrieve the session
    from data store. If it fails, will create a new ses-
    sion id, which will be accessible through id() method.

    So you call new with the claimed session id if there is one. If it had
    expired, or doesn't exist in the first place, a new session will be created
    automatically. Otherwise the old one will be retrieved.

    > Now I'm using the following code to create a new session
    >
    > local our $session_id=$query->param('session');
    > if ($session_id eq '' or $session_id eq '$SESSIONID') {


    Where does $SESSIONID get set? What does it get set to?

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , May 17, 2006
    #2
    1. Advertising

  3. Guest

    -here.net wrote:
    > writes:
    > > > Now I'm using the following code to create a new session
    > > >
    > > > local our $session_id=$query->param('session');
    > > > if ($session_id eq '' or $session_id eq '$SESSIONID') {

    > >
    > > Where does $SESSIONID get set? What does it get set to?

    >
    > It doesn't get set to ANYTHING, it's a string that looks confusingly
    > like a variable.


    Ah, yes. I missed that. I not sure if that makes things clearer or
    even less clear.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , May 17, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    486
  2. TSelvan
    Replies:
    1
    Views:
    1,786
    Natty Gur
    Jul 30, 2003
  3. Lenny

    Session Expired error

    Lenny, Jul 31, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    451
    Alvin Bruney
    Jul 31, 2003
  4. Joona I Palaste
    Replies:
    1
    Views:
    314
    Ole Arndt
    Aug 17, 2004
  5. Replies:
    0
    Views:
    178
Loading...

Share This Page