git.shiar.nl
/
perl
/
plp
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5d1c219
)
make PLP::Apache mod_perl 2.0 compatible
author
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 30 Jul 2007 08:22:28 +0000
(10:22 +0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 30 Jul 2007 08:22:28 +0000
(10:22 +0200)
PLP/Apache.pm
patch
|
blob
|
history
diff --git
a/PLP/Apache.pm
b/PLP/Apache.pm
index a18ed258de4d03f20b95ddf28a481bf2b7f09f51..fd2607bf13f0f5bd82901ceb90d2315cb6d52601 100644
(file)
--- a/
PLP/Apache.pm
+++ b/
PLP/Apache.pm
@@
-5,7
+5,21
@@
use strict;
our $VERSION = '1.00';
use PLP;
our $VERSION = '1.00';
use PLP;
-require Apache::Constants;
+
+use constant MP2 => (
+ defined $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} >= 2
+);
+
+BEGIN {
+ if (MP2) {
+ require Apache2::Const;
+ require Apache2::RequestRec;
+ require Apache2::RequestUtil;
+ require Apache2::RequestIO;
+ } else {
+ require Apache::Constants;
+ }
+}
# mod_perl initializer: returns 0 on success, Apache error code on failure
sub init {
# mod_perl initializer: returns 0 on success, Apache error code on failure
sub init {
@@
-16,10
+30,10
@@
sub init {
$ENV{PLP_FILENAME} = my $filename = $r->filename;
unless (-f $filename) {
$ENV{PLP_FILENAME} = my $filename = $r->filename;
unless (-f $filename) {
- return Apache::Constants::NOT_FOUND();
+ return
MP2 ? Apache2::Const::NOT_FOUND() :
Apache::Constants::NOT_FOUND();
}
unless (-r _) {
}
unless (-r _) {
- return Apache::Constants::FORBIDDEN();
+ return
MP2 ? Apache2::Const::FORBIDDEN() :
Apache::Constants::FORBIDDEN();
}
$ENV{PLP_NAME} = $r->uri;
}
$ENV{PLP_NAME} = $r->uri;
@@
-51,7
+65,7
@@
sub handler {
#S PLP::start($_[0]);
PLP::start();
no strict 'subs';
#S PLP::start($_[0]);
PLP::start();
no strict 'subs';
- return Apache::Constants::OK();
+ return
MP2 ? Apache2::Const::OK() :
Apache::Constants::OK();
}
1;
}
1;