perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From auta...@apache.org
Subject svn commit: r419247 - /perl/Apache-SizeLimit/trunk/Makefile.PL
Date Wed, 05 Jul 2006 15:06:30 GMT
Author: autarch
Date: Wed Jul  5 08:06:29 2006
New Revision: 419247

URL: http://svn.apache.org/viewvc?rev=419247&view=rev
Log:
Cannot call sub to define a constant if the sub has not yet been
defined, so just use a variable instead.

More refactoring to make flow of execution simpler (IMHO).

The test target works fine on my box without explicitly setting the
apache binary or apxs binary. It would be very bad form for a CPAN
module to die in the Makefile.PL! That'd break any attempt to install
it via a CPAN{PLUS} shell. I'll figure out how to make this optional
in a future commit.

Modified:
    perl/Apache-SizeLimit/trunk/Makefile.PL

Modified: perl/Apache-SizeLimit/trunk/Makefile.PL
URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/Makefile.PL?rev=419247&r1=419246&r2=419247&view=diff
==============================================================================
--- perl/Apache-SizeLimit/trunk/Makefile.PL (original)
+++ perl/Apache-SizeLimit/trunk/Makefile.PL Wed Jul  5 08:06:29 2006
@@ -20,7 +20,7 @@
     }
 }
 
-use constant HAS_APACHE_TEST => check_for_apache_test();
+my $HAS_APACHE_TEST = check_for_apache_test();
 
 WriteMakefile( VERSION_FROM    => "lib/Apache/SizeLimit.pm",
                NAME            => "Apache::SizeLimit",
@@ -30,24 +30,21 @@
              );
 
 sub check_for_apache_test {
-    return eval {
+    return unless eval {
         require Apache::Test;
         require Apache::TestMM;
         require Apache::TestRunPerl;
+        1;
+    };
 
-        Apache::TestMM->import(qw(test clean));
-        Apache::TestMM::filter_args();
-
-        my %args = @Apache::TestMM::Argv;
+    Apache::TestMM->import(qw(test clean));
+    Apache::TestMM::filter_args();
 
-        die 'suitable httpd required'
-          unless ($args{apxs} or $args{httpd} or
-                  $ENV{APACHE_TEST_HTTPD} or $ENV{APACHE_TEST_APXS});
+    my %args = @Apache::TestMM::Argv;
 
-        Apache::TestRunPerl->generate_script();
+    Apache::TestRunPerl->generate_script();
 
-        return Apache::TestMM->test;
-    };
+    return 1;
 }
 
 sub MY::postamble {
@@ -65,26 +62,22 @@
 }
 
 sub MY::test {
+    my $self = shift;
 
-    my $test = shift->MM::test(@_);
-
-  eval { require Test::More } or return <<EOF;
+    eval { require Test::More } or return <<EOF;
 test::
 \t\@echo sorry, cannot run tests without Test::More
 EOF
 
-    return HAS_APACHE_TEST if HAS_APACHE_TEST;
+    return Apache::TestMM::test(@_) if $HAS_APACHE_TEST;
 
-    return $test;
+    return $self->MM::test(@_);
 }
 
 sub MY::clean {
+    my $self = shift;
 
-    if (HAS_APACHE_TEST) {
-        require Apache::TestMM;
-
-        return Apache::TestMM::clean(@_);
-    }
+    return Apache::TestMM::clean(@_) if $HAS_APACHE_TEST;
 
     return shift->MM::clean(@_);
 }



Mime
View raw message