I installed Devel::Cover and ran it against my web application test suite, and got some lovely coverage information about .. my test suite.

My next step was to use Devel::Cover in the web application itself, and to do that I needed to specify the directory where I wanted to leave its database. Simple!

Or not. I tried setting %ENV in a BEGIN clause in the top-level module -- it didn't take. I tried using SetEnv in the httpd.conf file and doing a graceful restart of Apache. Nope -- no luck.

So now I'm wondering if anyone else has managed to do this -- I plan on adding more options so that Devel::Cover doesn't map out all of the parts of CGI::Application that get used -- fascinating information, but not relevant to my goal, which is to find out which paths in my code get used for particular functions.

Update at 1445, February 14, 2007: dragonchild asks, why would I want to do this? Good question.

I'm a one-man web development team, so can't really do the XP thing with anyone else. This means tools like Devel::Cover will help me understand what's happening with my code when I perform certain operations in the web application.

My first shot at using Devel::Cover was yesterday, when I ran it again my test scripts, which use LWP::UserAgent (for REST access) and WWW:Mechanize (for web access) to communicate with my web application. This produced coverage for my test scripts, but I'm more interested in the source code of my application, hence the quest for turning it on, and setting some options, from within Apache.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds


In reply to Setting Devel::Cover options for a web application by talexb

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.