line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package experimentals; |
2
|
|
|
|
|
|
|
our $VERSION = '0.020'; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
1376
|
use 5.010; |
|
2
|
|
|
|
|
7
|
|
5
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
39
|
|
6
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
70
|
|
7
|
2
|
|
|
2
|
|
12
|
use feature (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
267
|
|
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
|
|
15
|
no warnings 'void'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
814
|
|
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
|
|
|
|
|
|
|
# Handle deprecation of smartmatching in Perl 5.38..5.40 |
40
|
4
|
50
|
33
|
4
|
|
3463
|
warnings->unimport('deprecated::smartmatch') |
41
|
|
|
|
|
|
|
if $] >= 5.038 && $] < 5.042; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Always enable all available features... |
44
|
4
|
|
|
|
|
281
|
feature->import(keys %FEATURES); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Turn on utf8 if the feature requires it... |
47
|
4
|
50
|
|
|
|
16
|
if ($FEATURES{ extra_paired_delimiters }) { |
48
|
0
|
|
|
|
|
0
|
require utf8; |
49
|
0
|
|
|
|
|
0
|
utf8->import(); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Are we reporting??? |
53
|
4
|
50
|
|
|
|
9
|
my $reporting = grep { defined $_ && lc($_) eq '-report' } @_; |
|
4
|
|
|
|
|
24
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# If not reporting, disable all warnings about experimental features... |
56
|
4
|
50
|
|
|
|
10
|
if (!$reporting) { |
57
|
4
|
|
|
|
|
518
|
warnings->unimport(keys %WARNINGS); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Otherwise, set up a filter to grab and reformat experimental warnings... |
61
|
|
|
|
|
|
|
else { |
62
|
|
|
|
|
|
|
# Enable the warnings we're going to grab... |
63
|
0
|
|
|
|
|
0
|
warnings->import(keys %WARNINGS); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# Install the code to grab them... |
66
|
0
|
|
|
|
|
0
|
$SIG{__WARN__} = \&_report_experimentals; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Prevent actual code execution... |
69
|
0
|
|
|
|
|
0
|
$DO_NOT_RUN = 1; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Handle 'no experimentals'... |
74
|
|
|
|
|
|
|
sub unimport { |
75
|
|
|
|
|
|
|
# Enable features that don't have experimental warnings... |
76
|
2
|
|
|
2
|
|
897
|
feature->import(grep { !$WARNINGS{"experimental::$_"} } keys %FEATURES); |
|
28
|
|
|
|
|
204
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Enable experimental warnings... |
79
|
2
|
|
|
|
|
164
|
warnings->import(keys %WARNINGS); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |