problems with Makefile.PL for libapreq 1.33

Michael Peters <[email protected]>
Newsgroups gmane.comp.apache.mod-perl,gmane.comp.apache.apreq
Message-ID <[email protected]>
This is kind of convoluted, but bare with me:

I have Apache2/mod_perl2 and Apache::Test installed on my system (FC6) in the
standard locations. I now want to install Apache1/mod_perl1 and libapreq 1.33 in
a separate location that doesn't have Apache::Test. Now running Makefile.PL in
for libapreq (after Apache1/mod_perl1 have already been built in my local
install of course) always fails with this message:

mod_perl 1.x ( < 1.99) is required at Makefile.PL line 58

And it doesn't matter what I put into PERL5LIB, LIB, APXS or APACHE environment
vars. The reason is because libapreq's Makefile.PL first tries to locate
Apache::Test, which on my system is configured to work with Apache2/mod_perl2.
Apache::Test loads Apache::TestConfig which then loads mod_perl2.pm. And that's
how it's supposed to work. But Apache::TestConfig sets $INC{'mod_perl.pm'} to
/dev/null so when libapreq's Makefile.PL tries to require mod_perl it instead
thinks it's mod_perl2 (not because mod_perl2 comes before mod_perl in @INC, but
because Apache::Test specifically loads mod_perl2).

The attached patch should fix this problem in Makefile.PL by doing the test for
mod_perl version before the test for Apache::Test.

-- 
Michael Peters
Developer
Plus Three, LP
Makefile.PL.patch (text/x-patch, 1.1 KB)
--- Makefile.PL	2004-12-06 10:31:08.000000000 -0500
+++ Makefile.PL.new	2007-05-10 11:19:46.000000000 -0400
@@ -6,6 +6,18 @@
 use File::Path qw(mkpath);
 use lib qw(Apache-Test/lib);
 
+BEGIN {
+    unless (eval {require mod_perl}) {
+        die "Please install mod_perl: 1.25 < version < 1.99\n($@)";
+    }
+    if ($mod_perl::VERSION < 1.2402) {
+        die "Please upgrade mod_perl to 1.24_02 or greater";
+    }
+    elsif ($mod_perl::VERSION > 1.98) {
+        die "mod_perl 1.x ( < 1.99) is required";
+    }
+}
+
 use constant MIN_A_T_VERSION => 1.13;
 
 use constant HAS_APACHE_TEST => eval {
@@ -23,17 +35,6 @@
     require Apache::TestMM;
     Apache::TestMM->import(qw(test clean));
 }
-BEGIN {
-    unless (eval {require mod_perl}) {
-        die "Please install mod_perl: 1.25 < version < 1.99\n($@)";
-    }
-    if ($mod_perl::VERSION < 1.2402) {
-        die "Please upgrade mod_perl to 1.24_02 or greater";
-    }
-    elsif ($mod_perl::VERSION > 1.98) {
-        die "mod_perl 1.x ( < 1.99) is required";
-    }
-}
 
 my $conf_data = join '', <DATA>;
 $conf_data =~ s|(blib/arch)|$FindBin::Bin/$1|;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.