Tyler MacDonald wrote: > I'm trying to get code coverage metrics of an apache2 module I'm developing, > using Devel::Cover. I've figured out a way to do it, but it's a bit hacky > :-) > > Devel::Cover instructs you to run "make test" like so: > > HARNESS_PERL_SWITCHES=-MDevel::Cover make test > > to get coverage analysis. What I've done to make the apache server use this > is: > > 1) Add "PerlPassEnv HARNESS_PERL_SWITCHES" to my extra.last.conf.in > > 2) Add the following block of code to my modperl_extra.pl: > > if( > $ENV{HARNESS_PERL_SWITCHES} && > $ENV{HARNESS_PERL_SWITCHES} =~ m{Devel::Cover} > ) { > eval "use Devel::Cover;"; > } > > Is this the cleanest way to accomplish this?
it's pretty much the only way at this point. see http://search.cpan.org/src/GEOFF/Apache-SSLLookup-2.00_04/ for pretty much those exact steps :) I keep meaning to document this. doc patches much appreciated. > Ideally I would have liked > something that could be done with any mod_perl module without adding code to > the test suite itself... it can't really be done without making those changes. at least not at the moment. I guess we could have TestConfigPerl put in the appropriate foo in the generated httpd.conf though... --Geoff