From: Aaron Trevena Date: Tue, 9 Aug 2005 23:39:38 +0000 (+0000) Subject: Apache2 fix in Apache::MVC (bug 13888) X-Git-Tag: 2.11~147 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=maypole.git;a=commitdiff_plain;h=421bc934b04227b92c05efc6a60939150b6fc751 Apache2 fix in Apache::MVC (bug 13888) git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@371 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/Changes b/Changes index b0e2172..c5192b3 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,8 @@ For information about current developments and future releases, see: Fix to cgi_maypole.t (bug 11346) Fix to TT error reporting (bug 13991) Template xhtml validation (bug 13975) + Simplified Net::Amazon example (bug 14073) + Apache2 fix in Apache::MVC (bug 13888) 2.10 Tue 19 Jul 2005 Multiple Template Paths added ( http://rt.cpan.org/NoAuth/Bug.html?id=13447 ) diff --git a/lib/Apache/MVC.pm b/lib/Apache/MVC.pm index c7bfdef..62afc95 100644 --- a/lib/Apache/MVC.pm +++ b/lib/Apache/MVC.pm @@ -1,29 +1,37 @@ package Apache::MVC; -our $VERSION = '2.09'; +our $VERSION = '2.10'; use strict; use warnings; use base 'Maypole'; -use mod_perl; use Maypole::Headers; -use constant APACHE2 => $mod_perl::VERSION >= 1.99; +BEGIN { + my $version; + eval 'use mod_perl2; $version = $mod_perl2::VERSION; '; + if ($@) { + warn "no mod_perl 2.x using mod_perl 1.x\n"; + use mod_perl; + $version = 0; + require Apache; + require Apache::Request; + } else { + require Apache2::RequestIO; + require Apache2::RequestRec; + require Apache2::RequestUtil; + require APR::URI; + require Apache2::Request; + } + + use constant APACHE2 => $version; -if (APACHE2) { - require Apache2; - require Apache::RequestIO; - require Apache::RequestRec; - require Apache::RequestUtil; - require APR::URI; } -else { require Apache } -require Apache::Request; sub get_request { my ( $self, $r ) = @_; - $self->{ar} = Apache::Request->new($r); + $self->{ar} = (APACHE2) ? Apache2::Request->new($r) : Apache::Request->new($r); } sub parse_location {