git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: gitweb: Version independent mod_perl woes

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 21, 2006, 18:09 UTC
Message-ID
<200612211909.35615.jnareb@gmail.com>
In-Reply-To
<200612211807.54668.jnareb@gmail.com>
Jakub Narebski wrote:
Show 8 quoted lines
> -- >8 --
> # Set the constant MP_GEN to 0 if mod_perl is not available,
> # to 1 if running under mod_perl 1.0
> # and 2 for mod_perl 2.0
> use constant MP_GEN => $ENV{'MOD_PERL'}
>         ? { ( exists $ENV{'MOD_PERL_API_VERSION'} and 
>               $ENV{'MOD_PERL_API_VERSION'} >= 2 ) ? 2 : 1 }
>         : 0;
Actually, the error was here. It works like expected for
 use constant {
 	MP_GEN => ($ENV{'MOD_PERL'}
 	           ? ( exists $ENV{'MOD_PERL_API_VERSION'} and 
 	               $ENV{'MOD_PERL_API_VERSION'} >= 2 ) ? 2 : 1
 	           : 0),
 };
Show 22 quoted lines
> # use appropriate mod_perl modules (conditional use)
> BEGIN {
>         if (MP_GEN == 2) {
>                 require Apache2::RequestRec;
>                 require Apache2::ServerRec;
>                 require Apache2::Response;
>                 require Apache2::Const;
>                 import Apache2::RequestRec;
>                 import Apache2::ServerRec;
>                 Apache2::Const->import(-compile => qw(:common :http));
>         } elsif (MP_GEN == 1) {
>                 require Apache;
>                 require Apache::Constants;
>                 import Apache;
>                 Apache::Constants->import(qw(:common :http));
>         }
> }
> 
> # mod_perl request
> my $r;
> $r = shift @_ if MP_GEN;
> -- >8 --
Sorry for the noise.
-- 
Jakub Narebski
Poland
Previous: Jakub Narebski
Message 3 of 3 in “gitweb: Version independent mod_perl woes”
  1. Jakub NarebskiDec 21, 2006
  2. Jakub NarebskiDec 21, 2006
  3. Jakub NarebskiDec 21, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.