Skip Menu |

This queue is for tickets about the CGI-Session CPAN distribution.

Report information
The Basics
Id: 2227
Status: resolved
Priority: 0/
Queue: CGI-Session

People
Owner: Nobody in particular
Requestors: chris [...] clotho.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 3.92
Fixed in: (no value)



Subject: flag for new session
Sometimes I want my code to behave differently if the current hit is a new session instead of an old one. Currently, the only way to tell if a session is new is to compare the atime to the ctime. However, in testing (albeit an unrealistic case) if there are two hits inside of one second, the second looks like a new session based on my test, when it is not. If _init_new_session added a property "_NEW_SESSION => 1", that would be enormously valuable for the creation of an isNewSession() method. Below is a patch to implement this behavior. It is untested. Chris Dolan ----------------------------------------------------------------- diff -u Session.pm-orig Session.pm --- Session.pm-orig 2003-03-13 13:00:31.000000000 -0600 +++ Session.pm 2003-03-13 13:01:53.000000000 -0600 @@ -301,12 +301,17 @@ }; $self->{_STATUS} = MODIFIED; + $self->{_NEW_SESSION} = 1; return 1; } - - +sub isNewSession +{ + my $self = shift; + + return $self->{_NEW_SESSION} ? 1 : 0; +} # id() - accessor method. Returns effective id # for the current session. CGI::Session deals with
Date: Fri, 14 Mar 2003 00:06:12 -0700 (MST)
From: Sherzod Ruzmetov <sherzodr [...] handalak.com>
To: Guest via RT <bug-CGI-Session [...] rt.cpan.org>
Subject: Re: [cpan #2227] flag for new session
RT-Send-Cc:
Chris, :Sometimes I want my code to behave differently if the current hit is a new session instead of an old one. Currently, the only way to tell if a session is new is to compare the atime to the ctime. However, in testing (albeit an unrealistic case) if there are two hits inside of one second, the second looks like a new session based on my test, when it is not. : :If _init_new_session added a property "_NEW_SESSION => 1", that would be enormously valuable for the creation of an isNewSession() method. : :Below is a patch to implement this behavior. It is untested. Great, I'll make sure to apply it asap. I may call it "is_new_session()" instread of "isNewSession()" for consistency. sherzod
The issue is resolved in CGI-Session-3.93