John Siracusa wrote: > On Thu, 17 Mar 2005 17:39:21, Dominique Quatravaux <[EMAIL PROTECTED]> wrote: > >>For the record I use the following dubious hack as an interim measure: >> >>sub modperl_major_version { >>~ use DynaLoader (); >>~ return 1 if DynaLoader::dl_find_symbol_anywhere("XS_Apache_define"); >>~ return 2 if >>DynaLoader::dl_find_symbol_anywhere("XS_ModPerl__Util_exit"); >>~ return undef; >>} > > > I have a function with almost exactly the same name, but I'm stripping the > version out of the environment variable. I'd also like to see a "cleaner" > way to do this. The DynaLoader method is not particularly reassuring... :)
just added to svn is $ENV{MOD_PERL_API_VERSION}, which is currently just "2". I guess I understand why it's somewhat inconvenient sometimes to rely on %ENV, as with the system() example, but I'm not so sure that %ENV isn't sufficient - eval { Apache->server } or somesuch would clearly let you know whether or not you're running under mod_perl or a forked process. and CGI.pm seems to intelligently distinguish between $ENV{MOD_PERL} coming from a real apache environment and from a system()-type environment (if I glanced the code properly). what exactly is the issue you guys are trying to work around? --Geoff