Did I send out something weird?  My version looks like this:

        # Turn on special checking for Doug MacEachern's modperl
        if (exists $ENV{MOD_PERL}) {
                 eval "require mod_perl";
                if (defined $mod_perl::VERSION) {
                        if ($mod_perl::VERSION >= 1.99) {
                                $MOD_PERL = 2;
                                require Apache::RequestRec;
                                require Apache::RequestUtil;
                                require APR::Pool;
                         } else {
                                $MOD_PERL = 1;
                                require Apache;
                        }
                }
        }

Lincoln


On Thursday 13 March 2003 06:21 pm, Stas Bekman wrote:
> Lincoln Stein wrote:
> > Please find enclosed a beta version of CGI.pm 2.92.  I would appreciate
> > it if people could test it on both mod_perl 1 and mod_perl 2, as well as
> > under normal CGI scripts too ;-)
>
> Thanks Lincoln. 'make test' passes with mp1 and mp2, however the test
> suites aren't exhaustively cover CGI.pm's functionality. So we really need
> your help guys to give it a good test in the real apps.
>
> > In case anyone wonders why I fiddled with the check for the presence of
> > modperl, this is because some people write scripts that shell out to
> > command-line scripts that invoke CGI.pm in order to generate HTML (don't
> > ask me why).  Without the additional checking, CGI.pm sees the MODPERL
> > environment variable, tries to load mod_perl outside the Apache
> > environment, and summarily crashes.
>
> Ahm, I'm not quite sure that this does what you say it should:
>
> if (exists $ENV{MOD_PERL}) {
>    require mod_perl;
>    if (defined $mod_perl::VERSION && ($mod_perl::VERSION >= 1.99)) {
>       # mp2
>    } else {
>       # mp1
>    }
> }
>
> because if it's not defined, it'll fall through to the else block, assuming
> that the external script is running under mp1. Shouldn't it be:
>
> if (exists $ENV{MOD_PERL}) {
>    require mod_perl;
>    # mod_perl handlers may run system() on scripts using CGI.pm
>    # - make sure so we don't get fooled by inherited $ENV{MOD_PERL}
>    if (defined $mod_perl::VERSION){ # for shell scripts
>      if ($mod_perl::VERSION >= 1.99)) {
>         # mp2
>      } else {
>         # mp1
>      }
>    }
> }
>
> also it's probably a good idea to add a note, why this check is done, so
> not to forget in the future and "optimize" it away ;)
>
> > I still haven't heard any response as to why I should move to MP2!  I
> > wasn't just being cranky, I'm curious.
>
> You want to move to MP2, if one of the following reasons apply:
>
> - you are stuck with Apache2
> - you want to use i/o filters
> - you want to write your own protocol handlers
> - you want to use a threaded mod_perl
> - you are stuck with win32 (mp1 is unusable on win32, serialization)
>
> and there is a whole bunch of new functionality available, which will be
> too long to list here and partially described on the website.
>
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
========================================================================
Lincoln D. Stein                           Cold Spring Harbor Laboratory
[EMAIL PROTECTED]                                         Cold Spring Harbor, NY
========================================================================

Reply via email to