Using Bryar in Mod_Perl 2.0

Hi - you seem to be new here. Please subscribe to my RSS feed to get the latest social news and information!

Please follow me on Twitter, Facebook, or FriendFeed to see what I'm up to. Thanks for visiting!

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);

Close
E-mail It
Blog Directory - Blogged