In the code you showed, nothing calls sub1, so I wasn't sure what you were thinking would happen there. If your real code does call it first on every request, then it should work.
There's no need to worry about concurrency. Even when using threads, each interpreter is separate and nothing is shared unless you explicitly make it shared. - Perrin On Sun, Feb 15, 2009 at 1:27 PM, André Warnier <a...@ice-sa.com> wrote: > Sorry, this list does not automatically set the reply-to, and I always > forget.. > > Perrin Harkins wrote: >> >> On Sat, Feb 14, 2009 at 5:50 AM, André Warnier <a...@ice-sa.com> wrote: >>> >>> Less nice, less neat, less classic, terrible style, whatever you want, >>> but >>> which also works : >> >> Yeah, I wouldn't really recommend this. Passing your $cgi object to >> subs that need it is the best solution. >> >>> I am not quite sure why it works, and I would appreciate if some mod_perl >>> guru could explain it. >> >> You're storing the CGI object in a global, and as long as your sub1 >> gets called on every request to put a new one in there before anything >> else tries to use it, it will work. If you ever try to use it before >> sub1 gets called, it will segfault. Not a very safe approach. >> > Ok, but that would only happen if the same code was run to process > another request while this one is going on. > Since to my knowledge each Apache child only processes one request at a > time, and each child has its own interpreter then, when exactly could > that happen ? In Apache MPM ? or are there other cases possible ? > > Not being snappy, would really like to know. > > >