| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package experimentals; |
|
2
|
|
|
|
|
|
|
our $VERSION = '0.017'; |
|
3
|
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
856
|
use 5.010; |
|
|
2
|
|
|
|
|
5
|
|
|
5
|
2
|
|
|
2
|
|
6
|
use strict; |
|
|
2
|
|
|
|
|
1
|
|
|
|
2
|
|
|
|
|
28
|
|
|
6
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
44
|
|
|
7
|
2
|
|
|
2
|
|
6
|
use feature (); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
198
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Module enables/disables these features... |
|
10
|
|
|
|
|
|
|
my %FEATURES |
|
11
|
|
|
|
|
|
|
= map { $_ => 1 } ( $] > 5.015006 ? keys %feature::feature |
|
12
|
|
|
|
|
|
|
: $] >= 5.011002 ? qw< say state switch unicode_strings > |
|
13
|
|
|
|
|
|
|
: $] >= 5.010000 ? qw< say state switch > |
|
14
|
|
|
|
|
|
|
: qw< > |
|
15
|
|
|
|
|
|
|
); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Module disables these warnings... |
|
18
|
|
|
|
|
|
|
my %WARNINGS = map { $_ => 1 } grep { /^experimental::/ } keys %warnings::Offsets; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# In -report mode, the code is not run... |
|
21
|
|
|
|
|
|
|
my $DO_NOT_RUN; |
|
22
|
|
|
|
|
|
|
{ |
|
23
|
2
|
|
|
2
|
|
9
|
no warnings 'void'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
531
|
|
|
24
|
|
|
|
|
|
|
INIT { exit if $DO_NOT_RUN; } |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Grab and reformat experimental warnings (when assigned to $SIG{__WARN__})... |
|
28
|
|
|
|
|
|
|
sub _report_experimentals { |
|
29
|
0
|
|
|
0
|
|
0
|
my $warning = "@_"; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Reformat any experimental warning (ignoring anything else)... |
|
32
|
0
|
0
|
|
|
|
0
|
if ($warning =~ m{\A(.*) is experimental\b(?:.*) at (.* line \d+)}) { |
|
33
|
0
|
|
|
|
|
0
|
printf {*STDERR} "%s:\t%s\n", $2, ucfirst $1; |
|
|
0
|
|
|
|
|
0
|
|
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Handle 'use experimentals'... |
|
38
|
|
|
|
|
|
|
sub import { |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Always enable all available features... |
|
41
|
6
|
|
|
6
|
|
4624
|
feature->import(keys %FEATURES); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Are we reporting??? |
|
44
|
6
|
50
|
|
|
|
12
|
my $reporting = grep { defined $_ && lc($_) eq '-report' } @_; |
|
|
6
|
|
|
|
|
27
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# If not reporting, disable all warnings avout experimental features... |
|
47
|
6
|
50
|
|
|
|
11
|
if (!$reporting) { |
|
48
|
6
|
|
|
|
|
461
|
warnings->unimport(keys %WARNINGS); |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Otherwise, set up a filter to grab and reformat experimental warnings... |
|
52
|
|
|
|
|
|
|
else { |
|
53
|
|
|
|
|
|
|
# Enable the warnings we're going to grab... |
|
54
|
0
|
|
|
|
|
0
|
warnings->import(keys %WARNINGS); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Install the code to grab them... |
|
57
|
0
|
|
|
|
|
0
|
$SIG{__WARN__} = \&_report_experimentals; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Prevent actual code execution... |
|
60
|
0
|
|
|
|
|
0
|
$DO_NOT_RUN = 1; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Handle 'no experimentals'... |
|
65
|
|
|
|
|
|
|
sub unimport { |
|
66
|
|
|
|
|
|
|
# Enable features that don't have experimental warnings... |
|
67
|
3
|
|
|
3
|
|
429
|
feature->import(grep { !$WARNINGS{"experimental::$_"} } keys %FEATURES); |
|
|
45
|
|
|
|
|
237
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# Enable experimental warnings... |
|
70
|
3
|
|
|
|
|
155
|
warnings->import(keys %WARNINGS); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__END__ |