Scenario/CPANInstallers/cpanm_local.pm

filter: Statementstmt 67.7% 21 / 31 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 67.5% 27 / 40 CC 2 SCAR 8.1
CC
2
Cov
64%
__ANON__
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
↑ Summary ScenarioR/CPANInstallers/cpanm_local.pm »
1 package Bencher::Scenario::CPANInstallers::cpanm_local;
2  
3 1 our $DATE = '2017-01-25'; # DATE
4 1 our $VERSION = '0.003'; # VERSION
5  
6 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use App::lcpan::Call qw(check_lcpan);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use File::Temp qw(tempdir);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use URI::Escape;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 our $scenario = {
15 summary => 'Benchmark installing modules from a local mirror using cpanm',
16 description => <<'_',
17  
18 This benchmark runs `cpanm Moose` with `-n` (no testing), `--mirror
19 LOCAL_CPAN_MIRROR_PATH --mirror-only` (no consulting the network), and
20 `--local-lib-contained TEMP_DIR`. This measures more or less "raw" cpanm
21 performance.
22  
23 To run this benchmark, you need a fairly recent local CPAN mirror
24 (downloaded/maintained using <pm:App::lcpan>).
25  
26 _
27 modules => {
28 'App::cpanminus' => {},
29 },
30  
31 participants => [
32 {
33 name => "cpanm",
34 cmdline_template => ["cpanm", "--mirror", '<mirror_url>', "--mirror-only", "-L", '<tempdir>', "-n", '<module>'],
35 },
36 ],
37  
38 runner => "Benchmark::Dumb::SimpleTime",
39  
40 precision => 1,
41  
42 test => 0,
43  
44 0 ▶ before_list_datasets => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
45 0 my %args = @_;
46  
47 0 my $scenario = $args{scenario};
48  
49 # add dataset
50 {
51 0 my $check_res = check_lcpan();
52 0 ▶ die "$check_res->[1]\n" unless $check_res->[0] == 200;
Branch: 1 branch
BranchTrueFalseTotal
unless $check_res->[0] == 200 0 0 0
53 0 my $mirror_path = $check_res->[2]{cpan};
54  
55 #my $mirror_url = "file:" . uri_escape($mirror_path);
56 0 my $mirror_url = "file:" . $mirror_path; # cpanm doesn't accept encoded URL?
57  
58 0 my $tempdir = tempdir(CLEANUP => 1);
59  
60 0 push @{ $scenario->{datasets} }, {
61 name => 'default',
62 seq => 0,
63 args => {mirror_url=>$mirror_url, tempdir=>$tempdir, module=>"Moose"},
64 };
65 }
66 },
67  
68 1 datasets => undef,
69 };
70  
71 1 1;
72 # ABSTRACT: Benchmark installing modules from a local mirror using cpanm
73  
74 __END__
↑ Summary ScenarioR/CPANInstallers/cpanm_local.pm »