line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
19529
|
use 5.008004; |
|
3
|
|
|
|
|
6
|
|
2
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
43
|
|
3
|
3
|
|
|
3
|
|
8
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
210
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package warnings::MaybeFatal; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN { |
11
|
3
|
50
|
|
3
|
|
52
|
if ( $] < 5.012 ) { |
12
|
0
|
|
|
|
|
0
|
require Lexical::SealRequireHints; |
13
|
0
|
|
|
|
|
0
|
Lexical::SealRequireHints->import; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
}; |
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
3
|
|
1183
|
use B::Hooks::EndOfScope; |
|
3
|
|
|
|
|
19340
|
|
|
3
|
|
|
|
|
19
|
|
18
|
3
|
|
|
3
|
|
175
|
use Carp qw(croak); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
146
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
BEGIN { |
21
|
3
|
50
|
|
3
|
|
15
|
B::Hooks::EndOfScope->Module::Implementation::implementation_for eq 'XS' |
22
|
|
|
|
|
|
|
or croak("Pure Perl implementation of B::Hooks::EndOfScope not supported"); |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _my_hints |
26
|
|
|
|
|
|
|
{ |
27
|
17
|
|
|
17
|
|
21
|
$^H |= 0x20000; |
28
|
17
|
|
|
|
|
134
|
\%^H; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub import |
32
|
|
|
|
|
|
|
{ |
33
|
8
|
|
|
8
|
|
3523
|
_my_hints->{+__PACKAGE__} = 1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Keep original signal handler |
36
|
8
|
|
|
|
|
18
|
my $orig = $SIG{__WARN__}; |
37
|
8
|
50
|
|
|
|
28
|
if (!ref($orig)) |
38
|
|
|
|
|
|
|
{ |
39
|
|
|
|
|
|
|
$orig = ($orig eq 'DEFAULT' or $orig eq 'IGNORE') |
40
|
|
|
|
|
|
|
? undef |
41
|
0
|
0
|
0
|
|
|
0
|
: do { |
42
|
3
|
|
|
3
|
|
220
|
no strict 'refs'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
508
|
|
43
|
0
|
0
|
|
|
|
0
|
exists(&{'main::'.$orig}) ? \&{'main::'.$orig} : undef; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
44
|
|
|
|
|
|
|
}; |
45
|
0
|
0
|
|
0
|
|
0
|
$orig = sub { warn(@_) } unless defined $orig; |
|
0
|
|
|
|
|
0
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
8
|
|
|
|
|
7
|
my @warnings; |
49
|
|
|
|
|
|
|
$SIG{__WARN__} = sub { |
50
|
8
|
100
|
|
8
|
|
612
|
_my_hints->{+__PACKAGE__} |
51
|
|
|
|
|
|
|
? push(@warnings, $_[0]) |
52
|
|
|
|
|
|
|
: $orig->(@_); |
53
|
8
|
|
|
|
|
27
|
}; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
on_scope_end { |
56
|
8
|
|
|
8
|
|
470
|
$SIG{__WARN__} = $orig; |
57
|
8
|
100
|
|
|
|
43
|
if (@warnings == 1) |
|
|
100
|
|
|
|
|
|
58
|
|
|
|
|
|
|
{ |
59
|
4
|
|
|
|
|
72
|
die($warnings[0]); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
elsif (@warnings) |
62
|
|
|
|
|
|
|
{ |
63
|
1
|
|
|
|
|
3
|
$orig->($_) for @warnings; |
64
|
1
|
|
|
|
|
5
|
local $Carp::CarpLevel = $Carp::CarpLevel + 1; |
65
|
1
|
|
|
|
|
158
|
croak("Compile time warnings"); |
66
|
|
|
|
|
|
|
} |
67
|
8
|
|
|
|
|
31
|
}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub unimport |
71
|
|
|
|
|
|
|
{ |
72
|
1
|
|
|
1
|
|
29
|
_my_hints->{+__PACKAGE__} = 0; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |