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)



Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.405 (Entity 5.404)
Subject: flag for new session
X-RT-Original-Encoding: iso-8859-1
Content-Length: 1112
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
Return-Path: <sherzodr [...] megs18.100mwh.com>
Delivered-To: cpan-bug+cgi-session [...] pallas.eruditorum.org
Received: from megs18.100mwh.com (megs18.100mwh.com [209.151.94.29]) by pallas.eruditorum.org (Postfix) with ESMTP id 1DF6411131 for <bug-CGI-Session [...] rt.cpan.org>; Fri, 14 Mar 2003 02:06:15 -0500 (EST)
Received: from sherzodr (helo=localhost) by megs18.100mwh.com with local-esmtp (Exim 3.36 #1) id 18tjGe-00039w-00 for bug-CGI-Session [...] rt.cpan.org; Fri, 14 Mar 2003 00:06:12 -0700
Date: Fri, 14 Mar 2003 00:06:12 -0700 (MST)
From: Sherzod Ruzmetov <sherzodr [...] handalak.com>
X-X-Sender: sherzodr [...] megs18.100mwh.com
To: Guest via RT <bug-CGI-Session [...] rt.cpan.org>
Subject: Re: [cpan #2227] flag for new session
In-Reply-To: <rt-2227-5950.10.2649732597551 [...] cpan.org>
Message-Id: <Pine.LNX.4.44.0303140004210.11901-100000 [...] megs18.100mwh.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Antiabuse: This header was added to track abuse, please include it with any abuse report
X-Antiabuse: Primary Hostname - megs18.100mwh.com
X-Antiabuse: Original Domain - rt.cpan.org
X-Antiabuse: Originator/Caller UID/GID - [32018 32018] / [32018 32018]
X-Antiabuse: Sender Address Domain - megs18.100mwh.com
RT-Send-Cc:
X-RT-Original-Encoding: us-ascii
Content-Length: 714
Download (untitled) / with headers
text/plain 714b
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
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.405 (Entity 5.404)
X-RT-Original-Encoding: iso-8859-1
Content-Length: 41
The issue is resolved in CGI-Session-3.93


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.