line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Prove::Elasticsearch::Provisioner::Perl; |
2
|
|
|
|
|
|
|
$App::Prove::Elasticsearch::Provisioner::Perl::VERSION = '0.001'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# PODNAME: App::Prove::Elasticsearch::Provisioner::Perl; |
5
|
|
|
|
|
|
|
# ABSTRACT: Provision perl on your SUT |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
100719
|
use strict; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
29
|
|
8
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
700
|
use App::perlbrew; |
|
1
|
|
|
|
|
37718
|
|
|
1
|
|
|
|
|
44
|
|
11
|
1
|
|
|
1
|
|
460
|
use Perl::Version; |
|
1
|
|
|
|
|
2021
|
|
|
1
|
|
|
|
|
73
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub get_available_provision_targets { |
14
|
2
|
|
|
2
|
1
|
1641
|
my ($cv) = @_; |
15
|
2
|
|
|
|
|
9
|
my $pb = App::perlbrew->new('list'); |
16
|
2
|
|
|
|
|
11
|
my @perls = $pb->available_perls(); |
17
|
1
|
|
|
1
|
|
7
|
no warnings 'numeric'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
135
|
|
18
|
|
|
|
|
|
|
@perls = grep { |
19
|
2
|
100
|
|
|
|
10
|
my $v_sanitized = $_; |
|
2
|
|
|
|
|
236
|
|
20
|
2
|
|
|
|
|
12
|
$v_sanitized =~ s/c?perl-?//g; |
21
|
2
|
|
|
|
|
5
|
$v_sanitized =~ s/\.0/\./g; #remove leading zero from ancient perls |
22
|
2
|
|
|
|
|
21
|
Perl::Version->new(sprintf("%.3f", $cv)) != |
23
|
|
|
|
|
|
|
Perl::Version->new(sprintf("%.2f", $v_sanitized)) |
24
|
|
|
|
|
|
|
} @perls if $cv; |
25
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
239
|
|
26
|
2
|
|
|
|
|
134
|
return @perls; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub pick_platform { |
30
|
1
|
|
|
1
|
1
|
1005
|
my (@plats) = @_; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
2
|
my $plat; |
33
|
1
|
|
|
|
|
3
|
foreach my $p (@plats) { |
34
|
4
|
100
|
|
|
|
9
|
if ($p =~ m/^perl/i) { |
35
|
1
|
|
|
|
|
2
|
$plat = $p; |
36
|
1
|
|
|
|
|
3
|
@plats = grep { $_ ne $p } @plats; |
|
4
|
|
|
|
|
7
|
|
37
|
1
|
|
|
|
|
9
|
last; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
1
|
|
|
|
|
4
|
return $plat, \@plats; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub can_switch_version { |
44
|
1
|
|
|
1
|
1
|
2194
|
return 0; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub switch_version_to { |
48
|
1
|
|
|
1
|
1
|
1773
|
die "Can't switch version via changing perl interpreter."; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub provision { |
52
|
1
|
|
|
1
|
1
|
5243
|
my ($desired_platform) = @_; |
53
|
1
|
|
|
|
|
9
|
my $pb = App::perlbrew->new('install'); |
54
|
1
|
|
|
|
|
8
|
$pb->run_command_install($desired_platform); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
#This *should*? be enough magic to 'do the deed' |
57
|
1
|
|
|
|
|
6
|
%ENV = $pb->perlbrew_env($desired_platform); |
58
|
1
|
|
|
|
|
54
|
return $desired_platform; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |