Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Perl: the Markov chain saw
 
PerlMonks  

Re: Setting Devel::Cover options for a web application

by chargrill (Parson)
on Feb 14, 2007 at 19:11 UTC ( #600044=note: print w/ replies, xml ) Need Help??


in reply to Setting Devel::Cover options for a web application

I tend to use a Makefile* for running coverage reports. Here's a relevant snippet:

OPENCMD = open BROWSER = /Applications/Safari.app clean: cover -delete test: prove cover.pl cover: make clean PERL5OPT=-MDevel::Cover=+ignore,.*\.t,-ignore,prove make test 2>&1 cover make report report: $(OPENCMD) $(BROWSER) cover_db/coverage.html

Customized a bit for a Mac, but the relevant parts are the PERL5OPTS ENV I'm setting, which points out how to ignore things using -ignore and +ignore - as long as you know the syntax it's expecting, the docs should clear things up. In a nutshell, I'm telling Devel::Cover to ignore my .t files, as well as the prove utility. Fascinating yes, but like you, that's not what I really care about :)

You don't necessarily need a Makefile for this, simply typing the following into an appropriate command line** will work***, too:

$ PERL5OPT=-MDevel::Cover=+ignore,.*\.t,-ignore,prove prove

Update: changed the PERL5OPT line a bit, added a little more explanation.

* I'm not great with Makefiles, but the above works for me.

** i.e. some unixish shell, other OSes may not let you specify environment variables like that.

*** assuming your test files are in `cwd` and named *.t.



--chargrill
s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)


Comment on Re: Setting Devel::Cover options for a web application
Select or Download Code
Re^2: Setting Devel::Cover options for a web application
by talexb (Canon) on Feb 14, 2007 at 19:33 UTC

    Outstanding! I changed the httpd.conf line to

    SetEnv PERL5OPT "-MDevel::Cover=-dir,/opt/FES/data"

    And it Just Worked. The time before that, I had a space instead of the comma. Crazy stuff, man. I think I'm gonna write to the author and pass that along. Thanks again!

    Alex / talexb / Toronto

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

      I'd suggest another addition to your httpd.conf:

      <IfDefine COVERAGE> SetEnv PERL5OPT "-MDevel::Cover=-dir,/opt/FES/data" </IfDefine>

      Add a new section in your apachectl (or however you launch apache):

      startcover() { echo -n $"Starting apache with code coverage: " $http_bin $other_options -DCOVERAGE }

      Adjusting where necessary for different apachectl's (ours is heavily customized, but anyone reasonably familiar with apache administration ought to be able to take it from here).

      And then just invoke it thusly:

      $ apachectl startcover


      --chargrill
      s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://600044]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (14)
As of 2014-04-24 12:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (565 votes), past polls