On Wed 19-Dec-2001 at 10:43:34AM -0500, Perrin Harkins wrote: > > ALWAYS reinitialize $Your::Singleton::ETERNAL on each query! > > mod_perl will *NOT* do it for you. > > If you want a per-request global, use $r->pnotes() instead of a standard > perl global. Then mod_perl *WILL* do it for you.
True. But then you are using the Apache object and you're program doesn't work as a standard CGI anymore :( > > You might think 'ah yeah but it would be nice if > > $Your::Singleton::ETERNAL could be persistent across queries...' which > > is sometimes desirable, but remember that if you have multiple instances > > of your application running on the same apache, > > $Your::Singleton::ETERNAL will be common to ALL of them. > > It will be common to all requests in that particular process, but not shared > between multiple Apache processes. If you take requests for different > applications that need different singletons on the same Apache process, you > should separate them by namespace so they don't collide. Yup, that's what I meant. Separating by namespace is not very convenient though. What I have been doing to get around this is that I wrote a simple module that can be used as a global scalar and that uses tie to return appropriate variable (FYI I've attached the module, if that interests anyone). Cheers, -- IT'S TIME FOR A DIFFERENT KIND OF WEB ================================================================ Jean-Michel Hiver - Software Director [EMAIL PROTECTED] +44 (0)114 221 4968 ================================================================ VISIT HTTP://WWW.MKDOC.COM
MPH.pm
Description: Perl program