File Coverage

blib/lib/Devel/DefaultWarnings.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 15 15 100.0


line stmt bran cond sub pod time code
1             package Devel::DefaultWarnings;
2 1     1   26982 use strict;
  1         1  
  1         32  
3 1     1   4 use warnings FATAL => 'all';
  1         2  
  1         51  
4              
5             our $VERSION = '0.001002';
6              
7 1     1   5 use base 'Exporter';
  1         5  
  1         419  
8             our @EXPORT = qw(warnings_default);
9              
10             my $check = do {
11             if ($] >= 5.016) { q{
12             !defined ${^WARNING_BITS};
13             } }
14             elsif ($] >= 5.008008) { q{
15             my $w = ${^WARNING_BITS};
16             local $^W = !$^W;
17             $w ne ${^WARNING_BITS};
18             } }
19             elsif ($] >= 5.006001) { q{
20             my $depth = 0;
21             while (my ($sub, $bits) = (caller(++$depth))[3,9]) {
22             if ($sub =~ /::BEGIN$/) {
23             local $^W = !$^W;
24             my $new_bits = (caller($depth))[9];
25             return $bits ne $new_bits;
26             }
27             }
28             ${^WARNING_BITS} eq $warnings::NONE;
29             } }
30             else { q{
31             ${^WARNING_BITS} eq $warnings::NONE;
32             } }
33             };
34              
35 3     3 1 5438 eval "sub warnings_default () { $check }; 1" or die $@;
36              
37             1;
38              
39             __END__