Re: gitweb: Version independent mod_perl woes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]