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? Ideally I would have liked
something that could be done with any mod_perl module without adding code to
the test suite itself... any ideas?
Thanks,
Tyler