httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Wheeler <da...@kineticode.com>
Subject Re: Makefile.PL Questions
Date Mon, 30 Jun 2003 18:40:27 GMT
On Monday, June 30, 2003, at 11:26  AM, Geoffrey Young wrote:

> I don't ever use CPAN.pm, so I don't know if the way I have been going 
> about it actually works or not, but my standard 1.0 Makefile.PL (which 
> was linked to in the perl.com article) looks something like
>
> sub MY::test {
>   eval {
>     require Apache::Test;
>     require Apache::TestMM;
>     require Apache::TestRunPerl;
>
>     Apache::TestMM->import(qw(test clean));
>     Apache::TestMM::filter_args();
>
>     Apache::TestRunPerl->generate_script();
>
>     return Apache::TestMM->test;
>   }
>
>   or return <<EOF;
> test::
> \t\@echo This test suite requires Apache-Test,
> \t\@echo which is available from the mod_perl 2.0
> \t\@echo sources, CPAN, or the httpd-test distribution.
> EOF
> }
>
> this makes 'make test' echo the error string or run the tests, 
> depending on whether A::T is installed.  in either case, 'make test' 
> is successful (I hope :)

That seems like a good idea. I just did some experimentation on my own, 
and discovered that both CPAN.pm and CPANPLUS run Makefile.PL twice -- 
once before satisfying dependences, and once after satisfying 
dependencies. So it works well structure the Makefile.PL like this:

if (eval {require Apache::Test}) {
     require Apache::TestMM;
     require Apache::TestRunPerl;
     Apache::TestMM->import(qw(test clean));
     Apache::TestMM::filter_args();
     Apache::TestRunPerl->generate_script();
} else {
     print "Skipping test setup.\n";
}

But I agree that it's smart to go one step further and install the 
default `make test` as you describe. I'll have to try that.

Thanks,

David

-- 
David Wheeler                                     AIM: dwTheory
david@kineticode.com                              ICQ: 15726394
http://kineticode.com/                         Yahoo!: dew7e
                                                Jabber: Theory@jabber.org
Kineticode. Setting knowledge in motion.[sm]


Mime
View raw message