title: How do I disable Devel::Cover for forked child processes?
body: <p>I noticed, that when I run my program with <code>perl -MDevel::Cover=-silent,-nogcov foo.pl</code> to collect coverage information for <code>foo.pl</code>, I am getting massive slowdowns from parts of my program that fork and exec non-perl programs like <code>tar</code>, <code>gzip</code> or <code>dpkg-deb</code>. Thanks to <a href="https://stackoverflow.com/questions/56856646/">this question</a> I figured out how to disable Devel::Cover selectively, so I'm now writing:</p>
  
  <pre><code>my $is_covering = !!(eval 'Devel::Cover::get_coverage()');
  my $pid = fork();
  if ($pid == 0) {
      eval 'Devel::Cover::set_coverage("none")' if $is_covering;
      exec 'tar', '-cf', ...
  }
  </code></pre>
  
  <p>Doing so, shaves off five minutes of runtime per test which, for 122 tests saves me 10 hours of computation time.</p>
  
  <p>Unfortunately, I cannot always add this eval statement into the forked child process. For example it's impossible to do so when I use <code>system()</code>. I want to avoid rewriting each of my <code>system()</code> calls to a manual <code>fork/exec</code>.</p>
  
  <p>Is there a way to disable Devel::Cover for my forked processes or basically for everything that is not my script <code>foo.pl</code>?</p>
  
  <p>Thanks!</p>