http://qs1969.pair.com?node_id=444933

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

I've got a medium sized mod_perl application that uses CGI::Application. I'm wanting to increase the test coverage so I installed Devel::Cover.

I'm having a hard time understanding what to do with it, however.

Is there a tutorial somewhere (not Devel::Cover::Tutorial, which is really advice about coverage)? Googling, super search, and the perl-qa mailing list archives provided no clues.

In more detail: I have a directory structure like:

lib/Foo/Bar/Baz.pm lib/Foo/Bar/Quux.pm lib/Foo/Bar/test.pl - just runs Test::Harness runtests lib/Foo/Bar/t/91.t docs/cgi-bin/a_webapp.pl docs/cgi-bin/another_webapp.pl

The Foo/Bar levels are essentially empty, which is why the t/ dir sits at the bottom, rather than at the top.

I run it like:

> perl -MDevel::Cover=-select,Foo lib/Foo/Bar/test.pl > cover -report html -outputdir /somewhere

Question 1: Should I run the test.pl, webapp.pl, or embed it in the mod_perl handler?
I believe that test.pl is right, because Devel::Cover is essentially telling me which bits of compiled code have been run when I call the script. And what I want to know which have been run by the tests.

However that gives me very little result - just those for the script itself, wheras runnig webapp.pl gives a much more complete picutre, including coverage for all the included modules, etc.

Or, I could run it on individual *.t files and merge the coverage databases ...

Question 2: How do I interpret the results?
The resulting reports have columns for statement, brand, condition and subroutine, next to the line of code. See a n example from Paul Johnson's site. What do the linked numbers mean? Are they the number of times the loc was encountered?

Sorry for the the somewhat vague questions. This looks like a wonderful tool, but I'm feeling my way around in the dark and I don't even know what I'm looking for. Any general advice on its use is appreciated.

thanks, qq