Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
P is for Practical
 
PerlMonks  

Writing tests for a module

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

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?

Cheers,
Ovid

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 18: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 CPAN.pm 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, CPAN.pm 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 John M. Dlugosz (Monsignor) on Jun 05, 2001 at 19: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 05, 2001 at 21:08 UTC
    It would sure be nice if you'd set it up so that CPAN.pm'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!
Re: Writing tests for a module
by Daddio (Chaplain) on Jun 05, 2001 at 21: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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://85922]
Approved by root
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.