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::
[EMAIL PROTECTED] This test suite requires Apache-Test,
[EMAIL PROTECTED] which is available from the mod_perl 2.0
[EMAIL PROTECTED] 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
[EMAIL PROTECTED]                              ICQ: 15726394
http://kineticode.com/                         Yahoo!: dew7e
                                               Jabber: [EMAIL PROTECTED]
Kineticode. Setting knowledge in motion.[sm]



Reply via email to