git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: Re: gitweb: Version independent mod_perl woes
Date: Thu, 21 Dec 2006 19:09:35 +0100	[thread overview]
Message-ID: <200612211909.35615.jnareb@gmail.com> (raw)
In-Reply-To: <200612211807.54668.jnareb@gmail.com>

Jakub Narebski wrote:
> -- >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),
 };

> # 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

      parent reply	other threads:[~2006-12-21 18:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-21 17:07 gitweb: Version independent mod_perl woes Jakub Narebski
2006-12-21 17:51 ` Jakub Narebski
2006-12-21 18:09 ` Jakub Narebski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200612211909.35615.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).