title: How can I make Perl die if a warning is generated?
body: <p>I would like my script perl to die whenever a warning is generated, including warnings which are generated by used packages.</p>
  
  <p>For example, this should die:</p>
  
  <pre><code>use strict;
  use warnings;
  use Statistics::Descriptive;
  
  my @data = ( 8, 9, 10, "bbb" );
  my $stat = Statistics::Descriptive::Full-&gt;new();
  $stat-&gt;add_data(@data);
  </code></pre>
  
  <p><code>use warnings FATAL =&gt; 'all';</code> won't help since it's lexically scoped. <a href="http://search.cpan.org/dist/Test-NoWarnings/" rel="noreferrer">Test::NoWarnings</a> also doesn't do the work since it doesn't kill the script.</p>