[Israel.pm] Testing your CPAN Module

Gabor Szabo gabor at perl.org.il
Sun Jul 4 04:37:52 PDT 2004

Yuval gave you already a number of good pointers,
let me add a few more:

http://qa.perl.org/ is the ultimate starting place for Perl QA modules.

I also maintain a Bundle including some explanations and links
to various resources.

> What easy to use tools are available to construct tests in
> Perl?
Start with Test::Simple and then move over to Test::More.

> * That all dependencies are available (how would I define them at the first place? How can I make sure they exist?)
I'd highly recommend Module::Build, - it can generate a Makefile.PL as
well for backward compability. Look at others how the use it, in my recent
CGI::FileManager module I have a simple example of using this.

> * How can I change the behaviour of the test suite depending on available prerequisites?
Look at the  SKIP capability of Test::More

> * take a text file (which is part of the distribution) and
> have the module segment it and then check for each special
> case if the segmentation was correct.

Once you started to write a number of tests you'll be able to refactor
your tests. I usually create a module called My::Module::Test and
put it in t/lib/My/Module/Test.pm This module then contains
a number of tools needed for my own testing purposes.


More information about the Perl mailing list