Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 657
ardavis Avatar asked Feb 24 '14 18:02

ardavis


2 Answers

The CSS file is cover_db/cover.css. Change at will.

like image 97
ikegami Avatar answered Nov 03 '22 04:11

ikegami


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.

like image 4
Lasse Avatar answered Nov 03 '22 04:11

Lasse