Using Bryar in Mod_Perl 2.0 – Stay N Alive

Using Bryar in Mod_Perl 2.0

I’ve made some additions to Bryar 2.6 to allow it to work in Mod_Perl 2.0.
Without these changes (see diffs below), you will see random caching problems
because it loads Frontend/CGI.pm instead of Frontend/Mod_Perl.pm.

Bryar/Config.pm:

44c44
+ $ENV{‘GATEWAY_INTERFACE’} =~ /^CGI-Perl\// or exists $ENV{MOD_PERL} and $ENV{MOD_PERL} =~ /^mod_perl\//)

– $ENV{‘GATEWAY_INTERFACE’} =~ /^CGI-Perl\//)

Bryar/Frontend/Mod_Perl.pm

3,5c3,5
+ #use Apache::Constants qw(OK);
+ #use Apache::Request;
+ #use Apache;

– use Apache::Constants qw(OK);
– use Apache::Request;
– use Apache;
12,44d11
+ BEGIN {
+
+ eval(‘require mod_perl;’);
+ if ( $@ ) {
+ require Apache2::mod_perl;
+ }
+
+ $::MP2 = ($mod_perl::VERSION >= 1.99);
+
+ if ($::MP2) {
+ require Apache2;
+ require Apache::Server;
+ require Apache::RequestRec;
+ require Apache::Log;
+ require APR::Table;
+ require Apache::RequestIO;
+ require Apache::SubRequest;
+ require Apache::Const;
+
+ Apache::Const->import(-compile => ‘OK’,’DECLINED’,’FORBIDDEN’,’NOT_FOUND’);
+
+ }
+ else {
+ require Apache;
+ require Apache::Constants;
+ require Apache::Request;
+
+ Apache::Constants->import(‘OK’,’DECLINED’,’FORBIDDEN’,’NOT_FOUND’);
+
+ }
+
+ }
+
58,62c25,27
+ sub obtain_params {
+ #my $apr = Apache::Request->new(Apache->request);
+ my $apr = new CGI;
+ map { $_ => $apr->param($_) } $apr->param ;
+ }

– sub obtain_params { my $apr = Apache::Request->new(Apache->request);
– map { $_ => $apr->param($_) } $apr->param ;
– }
65c30
+ Apache->request->status(‘OK’);

– Apache->request->status(OK);

Leave a Reply

Your email address will not be published. Required fields are marked *