Re: [Cgi-session-user] how load works (was: MySQL backend - multiple copies of session id's stored?
Brought to you by:
sherzodr
From: Justin S. <ju...@sk...> - 2006-07-30 22:32:54
|
> There's probably a bug here. Could you boil this down to a Test::More > style test case See what I can do ;) A good exercise anyways, since sometimes doing just that makes you realize some other complication in the code. Justin On Jul 29, 2006, at 9:29 PM, Mark Stosberg wrote: >> >> 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...@li... > https://lists.sourceforge.net/lists/listinfo/cgi-session-user > |