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


In reply to Devel::Cover tutorial wanted by qq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.