line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# To do: |
2
|
|
|
|
|
|
|
# - Turn die to croak (with tests) |
3
|
|
|
|
|
|
|
|
4
|
9
|
|
|
9
|
|
1104499
|
use strict; use warnings; |
|
9
|
|
|
9
|
|
22
|
|
|
9
|
|
|
|
|
480
|
|
|
9
|
|
|
|
|
49
|
|
|
9
|
|
|
|
|
28
|
|
|
9
|
|
|
|
|
490
|
|
5
|
|
|
|
|
|
|
package perl5; |
6
|
|
|
|
|
|
|
our $VERSION = '0.21'; |
7
|
|
|
|
|
|
|
|
8
|
9
|
|
|
9
|
|
7665
|
use version; |
|
9
|
|
|
|
|
21597
|
|
|
9
|
|
|
|
|
64
|
|
9
|
9
|
|
|
9
|
|
588
|
use Carp (); |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
749
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $requested_perl_version = 0; |
12
|
|
|
|
|
|
|
my $perl_version = 10; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub VERSION { |
15
|
14
|
|
|
14
|
0
|
8768
|
my ($class, $version) = @_; |
16
|
14
|
|
|
|
|
120
|
$version = version->parse($version); |
17
|
14
|
100
|
|
|
|
154
|
if ($version < 10) { |
18
|
2
|
|
|
|
|
3
|
my $this_version = do { |
19
|
9
|
|
|
9
|
|
49
|
no strict 'refs'; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
7342
|
|
20
|
2
|
|
|
|
|
4
|
version->parse(${$class . '::VERSION'}); |
|
2
|
|
|
|
|
14
|
|
21
|
|
|
|
|
|
|
}; |
22
|
2
|
50
|
|
|
|
11
|
if ($version > $this_version) { |
23
|
2
|
|
|
|
|
300
|
Carp::croak( |
24
|
|
|
|
|
|
|
"$class version $version required" . |
25
|
|
|
|
|
|
|
"--this is only version $this_version" |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else { |
30
|
12
|
|
|
|
|
144
|
$requested_perl_version = $version; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub version_check { |
35
|
36
|
|
|
36
|
0
|
55
|
my ($class, $args) = @_; |
36
|
|
|
|
|
|
|
|
37
|
36
|
100
|
|
|
|
96
|
if (defined $args->[0]) { |
38
|
27
|
|
|
|
|
39
|
my $version = $args->[0]; |
39
|
27
|
|
|
|
|
241
|
$version =~ s/^-//; |
40
|
27
|
100
|
66
|
|
|
81
|
if (version::is_lax($version) and version->parse($version) >= 10) { |
41
|
15
|
|
|
|
|
487
|
$requested_perl_version = version->parse($version); |
42
|
15
|
|
|
|
|
24
|
shift(@$args); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
36
|
100
|
|
|
|
923
|
if ($requested_perl_version) { |
46
|
27
|
|
|
|
|
170
|
my $version = $requested_perl_version->numify / 1000 + 5; |
47
|
27
|
|
|
|
|
37
|
$perl_version = $requested_perl_version; |
48
|
27
|
|
|
|
|
87
|
$requested_perl_version = 0; |
49
|
27
|
|
|
1
|
|
1563
|
eval "use $version"; |
|
1
|
|
|
1
|
|
13
|
|
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
1
|
|
26
|
|
|
1
|
|
|
1
|
|
21
|
|
|
1
|
|
|
1
|
|
3
|
|
|
1
|
|
|
1
|
|
28
|
|
|
1
|
|
|
1
|
|
14
|
|
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
1
|
|
28
|
|
|
1
|
|
|
1
|
|
12
|
|
|
1
|
|
|
1
|
|
3
|
|
|
1
|
|
|
1
|
|
25
|
|
|
1
|
|
|
1
|
|
12
|
|
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
1
|
|
34
|
|
|
1
|
|
|
1
|
|
12
|
|
|
1
|
|
|
1
|
|
3
|
|
|
1
|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
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
28
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
31
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
47
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
32
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
50
|
27
|
100
|
|
|
|
145
|
do { Carp::croak($@) } if $@; |
|
11
|
|
|
|
|
1963
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub import { |
55
|
36
|
50
|
|
36
|
|
11271
|
return unless @_; # XXX not sure why |
56
|
36
|
|
|
|
|
48
|
my $class = shift; |
57
|
36
|
|
|
|
|
108
|
$class->version_check(\@_); |
58
|
25
|
|
|
|
|
64
|
my $arg = shift; |
59
|
|
|
|
|
|
|
|
60
|
25
|
50
|
|
|
|
70
|
if ($class ne 'perl5') { |
61
|
0
|
|
|
|
|
0
|
(my $usage = $class) =~ s/::/-/; |
62
|
0
|
|
|
|
|
0
|
die "Don't 'use $class'. Try 'use $usage'"; |
63
|
|
|
|
|
|
|
} |
64
|
25
|
50
|
|
|
|
70
|
die "Too many arguments for 'use perl5...'" if @_; |
65
|
|
|
|
|
|
|
|
66
|
25
|
50
|
|
|
|
216
|
my $subclass = |
|
|
100
|
|
|
|
|
|
67
|
|
|
|
|
|
|
not(defined($arg)) ? __PACKAGE__ : |
68
|
|
|
|
|
|
|
$arg =~ /^-(\w+)$/ ?__PACKAGE__ . "::$1" : |
69
|
|
|
|
|
|
|
die "'$arg' is an invalid first argument to 'use perl5...'"; |
70
|
25
|
50
|
|
|
|
1337
|
eval "require $subclass; 1" or die $@; |
71
|
|
|
|
|
|
|
|
72
|
25
|
|
|
|
|
88
|
@_ = ($subclass); |
73
|
25
|
|
|
|
|
31
|
goto &{$class->can('importer')}; |
|
25
|
|
|
|
|
187
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub importer { |
77
|
25
|
|
|
25
|
0
|
36
|
my $class = shift; |
78
|
25
|
50
|
|
|
|
110
|
my @imports = scalar(@_) ? @_ : $class->imports; |
79
|
|
|
|
|
|
|
|
80
|
25
|
|
|
|
|
74
|
my $caller = caller(0); # maybe allow 'use perl5-foo package=>Bar'? |
81
|
25
|
|
|
|
|
1909
|
my $important = eval "package $caller; my \$sub = sub { shift->import(\@_) };"; |
82
|
|
|
|
|
|
|
|
83
|
25
|
|
|
|
|
86
|
while (@imports) { |
84
|
67
|
|
|
|
|
93
|
my $name = shift(@imports); |
85
|
67
|
100
|
100
|
|
|
257
|
my $version = (@imports and version::is_lax($imports[0])) |
86
|
|
|
|
|
|
|
? version->parse(shift(@imports))->numify : ''; |
87
|
67
|
100
|
100
|
|
|
1359
|
my $arguments = (@imports and ref($imports[0]) eq 'ARRAY') |
88
|
|
|
|
|
|
|
? shift(@imports) : []; |
89
|
|
|
|
|
|
|
|
90
|
67
|
100
|
|
|
|
3469
|
eval "require $name; 1" or die $@; # could be improved |
91
|
66
|
100
|
|
|
|
231
|
$name->VERSION($version) if $version; |
92
|
65
|
|
|
|
|
1658
|
$name->$important(@$arguments); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# goto &$important; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub imports { |
99
|
20
|
|
|
20
|
0
|
232
|
my $subversion = int($perl_version); |
100
|
|
|
|
|
|
|
return ( |
101
|
20
|
|
|
|
|
89
|
'strict', |
102
|
|
|
|
|
|
|
'warnings', |
103
|
|
|
|
|
|
|
'feature' => [":5.$subversion"], |
104
|
|
|
|
|
|
|
); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |