Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Test script requirements

by Sixtease (Friar)
on Mar 07, 2008 at 06:54 UTC ( #672696=perlquestion: print w/replies, xml ) Need Help??
Sixtease has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

My CPAN module's test script requires a module. But the distributed module does not. Should I add the requirement to the PREREQ_PM in Makefile.PL? Or should I condition the tests on the presence of the module? Or is there a better way?


use strict; use warnings; print "Just Another Perl Hacker\n";

Replies are listed 'Best First'.
Re: Test script requirements
by moritz (Cardinal) on Mar 07, 2008 at 08:05 UTC
    Or should I condition the tests on the presence of the module?

    Yes, that's the way to go. If that additional module is not needed for normal operation and building your module, it shouldn't be a requirement.

    And make sure to document the test requirement to enable menaingful testing.

      In my particular case, the module in question is List::MoreUtils, which, I gather, is a core module. I didn't care about it because I thought it's always present. But I'm getting mails from CPAN testers that the tests failed on the absence of List::MoreUtils. I assumed that the testers provide only those modules which are declared as required. If I condition the tests on them, then they will be skipped and the tests will not be run by the testers, which would deteriorate the benefit of the testers' work.

      Maybe I'm assuming wrongly and the tester's test failed because they really didn't have List::MoreUtils?

      use strict; use warnings; print "Just Another Perl Hacker\n";
        List::MoreUtils is not a core module.

        You might want to check out corelist, which is a command line interface to Module::CoreList. It tells you if a module is in core, and if so, from which perl version on.

        BTW it doesn't hurt to add core modules to your depency list, that way you're on the safe side, even if that module should be removed from core in future (unlikely, but not impossible).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://672696]
Approved by McDarren
Front-paged by Corion
[jedikaiti]: ahhhh
[jedikaiti]: Never heard it referred to that way
[jedikaiti]: Happy Birthday to him!
[Discipulus]: ah! how do you say in english? .. i was sure..
[Discipulus]: ah turned

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2018-01-18 20:34 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (214 votes). Check out past polls.