Devel::Cover - Save coverage data before the program ends

76 Views Asked by At

Question: Can I force Devel::Cover to dump/save coverage data within the code, e.g. cover->dump_coverage(), before the program terminates?

Context: I want to extract coverage reports even if I forcefully end the Perl process with kill -9, to which Devel::Cover cannot save its coverage data. I have found that Devel::Cover has a method to turning it off/on during runtime, but that doesn't seem to force the module to dump its data. Does it have another method to dump the coverage instead?

1

There are 1 best solutions below

0
pjcj On BEST ANSWER

On the Devel::Cover side, call Devel::Cover::report().

Catching the signal is up to you...