Re: [Cgi-session-user] how load works (was: MySQL backend - multiple copies of session id's stored?
Brought to you by:
sherzodr
From: Sherzod R. <she...@ha...> - 2006-07-30 03:39:39
|
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...@li...=20 > [mailto:cgi...@li...] On=20 > 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=20 > backend - multiple copies of session id's stored?) >=20 >=20 > > > > I could probably also use load? which wouldn't create a=20 > 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 =3D CGI::Session->load($self->{dsn}, $q, > > $self->{dsn_args}); >=20 >=20 > 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. >=20 > Looking at the docs for load(), it says: >=20 > Constructor. Usage is identical to new(), so is the return=20 > value. Major > difference is, new() can create new session if it detects=20 > expired and > non-existing sessions, but load() does not. >=20 > load() is useful to detect expired or non-existing=20 > sessions without=20 > forcing the > library to create new sessions. >=20 > 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=20 > create a new > session. >=20 > Looking at the code, load() /does/ have the ability to return=20 > 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. >=20 > > 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. >=20 > You mean, it's cloning the session of loading it, resulting=20 > in duplicate > entries in the database? That seems weird. >=20 > Mark >=20 > -------------------------------------------------------------- > ----------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the=20 > chance to share your > opinions on IT & business topics through brief surveys -- and=20 > earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge &CID=3DDEVDEV _______________________________________________ Cgi-session-user mailing list Cgi...@li... https://lists.sourceforge.net/lists/listinfo/cgi-session-user |