perldevel-cover

How can I change the CSS of Devel::Cover in Perl?


When running ./Build testcover to test the code coverage, is there a way I can pass in some kind of option for using my own stylesheet, maybe as an override?

I have looked at the Devel::Cover CPAN documentation to no avail.


Solution

  • Looking at the source of Devel::Cover::Report::Html_minimal, it seems you would need to make your own report format by subclassing that and overriding print_stylesheet() to do what you want. That's the "easy" part...

    Next you would need to get Module::Build to use your custom report format when running cover. Again, looking at the source, the default testcover action in Module::Build simply runs $self->do_system('cover') and as the cover script doesn't allow you to override the report format using an environment variable, you would have to override ACTION_testcover() in the build class for the given module.

    It seems like just mangling the default CSS file after running ./Build testcover as suggested in another answer is a much easier solution.