Scott Wang wrote:
Hi ,

I am new to use Devel::Cover.

We have lots of product Perl modules in our product "lib" folder and we have 
lots of Perl test scripts to cover those modules, right now, we are trying to get the 
code coverage metrics for our tests on those modules. I find we might get help by using 
Devel::Cover, would you please give me some idea on how I should use the Devel::Cover to 
generate our tests coverage metrics on our Perl modules?



Are you asking for assistance in how to get stats for a *single* Perl module? If so, that's easy (and easily learned from the docs):

perl Makefile.PL
make
cover -delete
make test HARNESS_PERL_SWITCHES=-MDevel::Cover
cover

That creates a subdirectory cover_db/which holds the database created by running Devel::Cover, as well as HTML files which vividly display what's covered and what's not by statement, branch, condition, subroutine, etc.

When I'm developing a Perl module I sometimes like to save text versions coverage reports in a separate subdirectory. So I'll call:

cover cover_db --report=text > coverage.mymodule.myversionnumber.txt

If, on the other hand, you're asking how to collate the results of running Devel::Cover on *many* modules, well, that's something I haven't had to do, though others have. Check archives of this list as well as Paul Johnson's home page.

jimk

Reply via email to