line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
9
|
|
|
9
|
|
179103
|
use strict; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
328
|
|
2
|
9
|
|
|
9
|
|
36
|
use warnings; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
394
|
|
3
|
|
|
|
|
|
|
package Warnings::Version; |
4
|
|
|
|
|
|
|
$Warnings::Version::VERSION = '0.002001'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Load warnings from a specific version of perl |
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
179
|
use 5.006; |
|
9
|
|
|
|
|
28
|
|
|
9
|
|
|
|
|
285
|
|
8
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
|
4696
|
use Import::Into; |
|
9
|
|
|
|
|
23912
|
|
|
9
|
|
|
|
|
5306
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my %warnings; |
12
|
|
|
|
|
|
|
$warnings{ categories } = [ qw/ all io severe syntax utf8 experimental / ]; |
13
|
|
|
|
|
|
|
$warnings{ all } = [ qw/ closure exiting glob io closed exec newline |
14
|
|
|
|
|
|
|
pipe unopened misc numeric once overflow pack portable recursion redefine |
15
|
|
|
|
|
|
|
regexp debugging inplace internal malloc signal substr syntax ambiguous |
16
|
|
|
|
|
|
|
bareword deprecated digit parenthesis precedence printf prototype qw |
17
|
|
|
|
|
|
|
reserved semicolon taint uninitialized unpack untie utf8 void / ]; |
18
|
|
|
|
|
|
|
$warnings{ '5.6' } = [ @{ $warnings{all} }, qw/ chmod umask y2k / ]; |
19
|
|
|
|
|
|
|
$warnings{ '5.8' } = [ @{ $warnings{all} }, qw/ layer threads y2k / ]; |
20
|
|
|
|
|
|
|
$warnings{ '5.10' } = [ @{ $warnings{all} }, qw/ layer threads / ]; |
21
|
|
|
|
|
|
|
$warnings{ '5.12' } = [ @{ $warnings{all} }, qw/ layer imprecision |
22
|
|
|
|
|
|
|
illegalproto threads / ]; |
23
|
|
|
|
|
|
|
$warnings{ '5.14' } = [ @{ $warnings{all} }, qw/ layer imprecision |
24
|
|
|
|
|
|
|
illegalproto threads surrogate non_unicode nonchar / ]; |
25
|
|
|
|
|
|
|
$warnings{ '5.16' } = [ @{ $warnings{all} }, qw/ layer imprecision |
26
|
|
|
|
|
|
|
illegalproto threads surrogate non_unicode nonchar / ]; |
27
|
|
|
|
|
|
|
$warnings{ '5.18' } = [ @{ $warnings{all} }, qw/ experimental::lexical_subs |
28
|
|
|
|
|
|
|
imprecision layer illegalproto threads non_unicode nonchar surrogate / ]; |
29
|
|
|
|
|
|
|
$warnings{ '5.20' } = [ @{ $warnings{all} }, qw/ experimental::autoderef |
30
|
|
|
|
|
|
|
experimental::lexical_subs experimental::lexical_topic |
31
|
|
|
|
|
|
|
experimental::postderef experimental::regex_sets experimental::signatures |
32
|
|
|
|
|
|
|
experimental::smartmatch imprecision layer syscalls illegalproto threads |
33
|
|
|
|
|
|
|
non_unicode nonchar surrogate / ]; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub import { |
37
|
8
|
|
|
8
|
|
73
|
my $package = shift; |
38
|
8
|
|
|
|
|
15
|
my $version = shift; |
39
|
8
|
50
|
|
|
|
38
|
$version = 'all' if not defined $version; |
40
|
8
|
|
|
|
|
28
|
warnings->import::into(scalar caller, get_warnings($version, $])); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub unimport { |
44
|
0
|
|
|
0
|
|
0
|
my $package = shift; |
45
|
0
|
|
|
|
|
0
|
my $version = shift; |
46
|
0
|
|
|
|
|
0
|
warnings->unimport::from(scalar caller, get_warnings($version, $])); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub get_warnings { |
50
|
82
|
|
|
82
|
0
|
56314
|
my $version = massage_version(shift); |
51
|
82
|
|
|
|
|
132
|
my $perl_version = massage_version(shift); |
52
|
|
|
|
|
|
|
|
53
|
82
|
50
|
|
|
|
206
|
die "Unknown version: $version\n" unless defined |
54
|
|
|
|
|
|
|
$warnings{ $version }; |
55
|
82
|
50
|
|
|
|
182
|
die "Unknown perl version: $perl_version\n" unless defined |
56
|
|
|
|
|
|
|
$warnings{ $perl_version }; |
57
|
|
|
|
|
|
|
|
58
|
82
|
|
|
|
|
86
|
my $wanted = $warnings{ $version }; |
59
|
82
|
|
|
|
|
84
|
my $available = $warnings{ $perl_version }; |
60
|
|
|
|
|
|
|
|
61
|
82
|
|
|
|
|
124
|
return intersection( $wanted, $available ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub massage_version { |
65
|
171
|
|
|
171
|
0
|
850
|
local $_ = shift; |
66
|
|
|
|
|
|
|
|
67
|
171
|
|
|
|
|
212
|
s/(5\.\d+)\..*/$1/; |
68
|
171
|
|
|
|
|
237
|
s/(5\.\d\d\d).*/$1/; |
69
|
171
|
|
|
|
|
595
|
s/(5\.)0*/$1/; |
70
|
|
|
|
|
|
|
|
71
|
171
|
|
|
|
|
263
|
return $_; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub intersection { |
75
|
82
|
|
|
82
|
0
|
91
|
my ($a1, $a2) = @_; |
76
|
82
|
|
|
|
|
65
|
my %count; |
77
|
|
|
|
|
|
|
|
78
|
82
|
|
|
|
|
58
|
return grep { $count{$_}++ == 1 } @{ $a1 }, @{ $a2 }; |
|
7881
|
|
|
|
|
10769
|
|
|
82
|
|
|
|
|
110
|
|
|
82
|
|
|
|
|
119
|
|
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |