in reply to Use a standard module or a "better" one, and how to make installing it troublefree.

First question is, do you use Test::More's improvements? I find that the standard Test module covers basic tests pretty well. No sense using Test::More unless you need it.

If you decide that you truly need Test::More's added flexibility, you can add a PREREQ_PM attribute to your WriteMakefile() call in Makefile.PL. It's a hashref, with the names being the module names and the values being the version number required for your script to run. Version number '0' means 'Any version'. Here's what it would be for a module called 'Devel::Refactorizer':

WriteMakefile( 'NAME' => 'Devel::Refactorizer', 'VERSION_FROM' => '', # finds $VERSION 'PREREQ_PM' => { 'Test::More' => 0}, # e.g., Module::Name +=> 1.1 ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => '', # retrieve abstract from mo +dule AUTHOR => 'A. U. Thor <a.u.thor@a.galaxy.far.far.away>') : +()), );

Truth in advertising: much of what I'm saying here is stuff I'm reading from the documentation right now for the first time. :)

If you were to install this module using CPAN, it would first attempt to do a 'make' on the distribution. This attempt would fail, since the Makefile will complain about lacking the Test::More module. Then, the CPAN module would download Test::More, build it, and then re-run 'make' on the Refactorizer. CPAN runs 'make test' after 'make', so Test::More would be in place for the tests.

Another approach: some folks bundle Test::More along with their module distributions. I personally think that this method clutters CPAN; observe what happens when you search for Test::More with However, it's a fairly small module, and some pretty bright people take this approach, so YMMV.


  • Comment on Re: Use a standard module or a "better" one, and how to make installing it troublefree.
  • Download Code

Replies are listed 'Best First'.
Re: Re: Use a standard module or a "better" one, and how to make installing it troublefree.
by Dog and Pony (Priest) on Apr 14, 2002 at 16:44 UTC
    Thank you! This sounds like exactly what I wanted to know. If I really need Test::More or not is a very valid question, but now I feel safer with taking that desicion if I feel I do need it. :)

    I guess that is the same question that I did ask, should I use a standard module or not - one of the criteria should definetely be "do I really need this?". Good point indeed.

    You mention that you read the documentation, could you please tell me where it is also? I looked through all the - what i thought - normal places for this, and couldn't find it. It is possible I have a small Sunday brain damage, so I'd appreciate it. :)

    I don't think I'll bundle it anyways, which means that one possibly still have a problem with non-CPAN installs, but heck, people will just have to read the README for once then. They should anyways. :)

    Again, thank you for the reply!

    You have moved into a dark place.
    It is pitch black. You are likely to be eaten by a grue.

      I searched for 'PREREQ_PM' in both the CPAN module documentation and the ExtUtils::MakeMaker docs. I always enjoy questions like this because, well, now I know too. :)