2

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?

delirium
  • 868
  • 6
  • 20
  • 1
    Why do you care about coverage data from a process that behaves so badly that you have to use SIGKILL instead of SIGTERM? (If you sent SIGTERM, you could use `$SIG{TERM} = sub { exit(128|15); };`) – ikegami Feb 19 '20 at 19:11
  • 1
    The `SIGKILL` can't be caught. While I don't know details of related `Devel::Cover` behavior, I'd expect that there is _nothing_ that _any_ software can do in response to it (a signal it can't trap). – zdim Feb 19 '20 at 22:26

1 Answers1

3

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

Catching the signal is up to you...

pjcj
  • 421
  • 2
  • 3