> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Saturday, December 17, 2005 2:29 PM > To: Mark Stosberg > Cc: cgiapp@lists.erlbaum.net > Subject: Re: [cgiapp] Re: C::A::P::Session not 'remembering' session > > > Mark, > > > > I recommended using postrun for this, becaues it runs after > every run > > mode in the module, but is only needed one once: After you > have logged > > in. I would find it more efficient and logicial to then call > > set_session() at the end of the login processing run mode. > > Thanks, I didn't realize that it ran after every run mode. > I'll put it up > in cgiapp_init. > > > > "postrun" tends to be rarely used my experience. > > > > The one related thing I have done is to call > "$self->session->flush()" > > in the teardown() phase. I think that should happen automatically. > > Are you saying flush happens automatically and not to use it? >
Yes, exactly. You can (and should) never call flush() directly, since it is automatically called when your CGI::Session object goes out of scope (i.e. it is DESTROYed). Not calling flush() is a nice way to check if you have memory leaks in your apps (I got bitten a couple of times by this). A memory leak could be caused by a circular reference: it happens for example if you save in a cgiapp param an external object whith a field which points back to the cgiapp object (and you don't weaken this latter reference). In this case, if you are using a persistent environment (such as (Apache|ModPerl)::Registry* or FastCGI), your CGI::Session object gets never DESTROYed, so your session parameters are not saved on disk (that is, at the next request you'll find your session data not updated). Ciao, Emanuele. --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/cgiapp@lists.erlbaum.net/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]