Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Writing tests for a module

by Ovid (Cardinal)
on Jun 05, 2001 at 22:14 UTC ( #85922=perlquestion: print w/replies, xml ) Need Help??

Ovid has asked for the wisdom of the Perl Monks concerning the following question:

Working on a proper distribution package for a module and was thinking about the tests that need to be written. I've pretty much stuck to standard modules for the module, but I've repeatedly seen new Monks say things like "We don't have [insert ubiquitous module name here] installed on our server. Is it overkill to write tests to see if they are there?


Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: Writing tests for a module
by bikeNomad (Priest) on Jun 05, 2001 at 22:21 UTC
    I don't bother checking in my modules, but it's reasonable to check in your Makefile.PL so they know when installing it (or knows) that they need something else. I even check for standard modules. If you use ExtUtils::MakeMaker, just add a PREREQ_PM hash arg to the arguments to WriteMakefile. From Archive-Zip's Makefile.PL:

    WriteMakefile( #snip PREREQ_PM => { 'Compress::Zlib' => 1.06, 'Carp' => 0, 'File::Path' => 0, 'File::Find' => 0, 'File::Basename' => 0, }, #snip );

    If you have PREREQ_PM set, will use it to load prerequisites. Also, the .PPD file (used by PPM) will have the dependency information, which will allow PPM to load the required modules.

    update: added explanation at end

Re: Writing tests for a module
by Daddio (Chaplain) on Jun 06, 2001 at 01:42 UTC

    There are a couple of good scripts on the List of installed modules node, specifically one I tried from cianoz. Don't know if that helps or not, but that one does work.

    D a d d i o

Re: Writing tests for a module
by John M. Dlugosz (Monsignor) on Jun 05, 2001 at 23:16 UTC
    No less reasonable than handling tech support manually. For people unfamiliar with Perl (customers want to run the program, not learn the language), a simple checker works wonders. For a set of perl scripts used by developers for certain testing, I included a check_setup script as well that makes sure it can find everything and explains about paths etc.
Re: Writing tests for a module
by traveler (Parson) on Jun 06, 2001 at 01:08 UTC
    It would sure be nice if you'd set it up so that's shell would install all needed modules when installing your new module. I've not investigated how to do that (no need, yet), but it is very handy when downloading new modules!

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://85922]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2022-11-30 03:11 GMT
Find Nodes?
    Voting Booth?