logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: how load works (was: MySQL backend - multiple copies of session id's st: msg#00018

Subject: Re: how load works (was: MySQL backend - multiple copies of session id's stored?)
Mark,

Right before I was coding load() I had a need for such functionality,
although no matter how hard I try to remember, I can't recall what exactly
created that need. But since then I wrote lots of code, and not even once
remember having to use load(). So, I'm not exactly sure what the purpose of
load() is, except adding to the complexity of the already complex code.


Usually in an application there really is no need for checking for the
existence of the actual session. It's too low level to be even concerned
about. Application should create a session at request, and check for
existence of certain session parameters. At least that's how I do it these
days.

Notifying the users about their expired sessions is also something not quite
necessary. Displaying the login screen conveys the same message, and also,
provides with an option to re-create a new login session, which in turn
saves bandwidth, and at least couple lines of code, if not more.


Sherzod


> -----Original Message-----
> From: 
> cgi-session-user-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx 
> [mailto:cgi-session-user-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx]
>  On 
> Behalf Of Mark Stosberg
> Sent: Saturday, July 29, 2006 11:30 PM
> To: Justin Simoni
> Cc: List - CGI-Session
> Subject: Re: [Cgi-session-user] how load works (was: MySQL 
> backend - multiple copies of session id's stored?)
> 
> 
>  >
>  > I could probably also use load? which wouldn't create a 
> new session, and
>  > then just try use the, is_empty() method.
>  >
>  > I'm still having trouble with accessing a session already created,
>  > something simple as:
>  >
>  >          require CGI::Session;
>  >             CGI::Session->name($LOGIN_COOKIE_NAME);
>  >          $session = CGI::Session->load($self->{dsn}, $q,
>  > $self->{dsn_args});
> 
> 
> There's probably a bug here. Could you boil this down to a Test::More
> style test case? It looks like you are nearly there.
> 
> Looking at the docs for load(), it says:
> 
>    Constructor. Usage is identical to new(), so is the return 
> value. Major
>    difference is, new() can create new session if it detects 
> expired and
>    non-existing sessions, but load() does not.
> 
>    load() is useful to detect expired or non-existing 
> sessions without 
> forcing the
>    library to create new sessions.
> 
> This contains an apparent contradiction, because it says the return
> value is the same as new(), but new() returns newly created sessions.
> That conflicts with the next paragraph that says it doesn't 
> create a new
> session.
> 
> Looking at the code, load() /does/ have the ability to return 
> new, empty
> sessions, which seems wrong. Do others agree?  "new()" is already
> magical that way. It doesn't seem that we need "load" to mean
> "load_or_new" as well.
> 
>  > Will not just read the already created session, it'll create a new
>  > session, with the exact same session id and exact same information
>  > inside the a_session column.
> 
> You mean, it's cloning the session of loading it, resulting 
> in duplicate
> entries in the database? That seems weird.
> 
>      Mark
> 
> --------------------------------------------------------------
> -----------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the 
> chance to share your
> opinions on IT & business topics through brief surveys -- and 
> earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge
&CID=DEVDEV
_______________________________________________
Cgi-session-user mailing list
Cgi-session-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/cgi-session-user


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>