How to configure perl to always run code coverage

I want my project to always run scripts via the perl Devel :: Cover module. I tried to replace the perl binary with something like this

#!/bin/sh
exec /usr/local/bin/original-perl -MDevel::Cover $@

      

without success. I would like to avoid changing #!

for every script on my system (not at the end of the world, I would just like to find a more global solution).

Any thoughts on how to enable Devel :: Cover globally?

Edit: Don't try to run this in production, just try some experimentation to figure out how to split the tightly coupled codebase. It would be helpful to have some automated way to see what source files are needed for a given subsystem (at least for a start)

+3


source to share


1 answer


You can set an environment variable PERL5OPT

to always load -MDevel::Cover

.

export PERL5OPT="-MDevel::Cover"

      

See perlrun for an explanation of this.




But as Michael Karman said, why would you do that? It will have significant performance overhead and may not be practical if you are not running tests.

+6


source







All Articles