blib/lib/CPAN/Distribution.pm

filter: Statementstmt 21.8% 779 / 3565 Branchbran 15.2% 354 / 2318 Conditioncond 10.9% 103 / 939 MC/DCmcdc 0.9% 5 / 523 Subroutinesub 38.9% 67 / 172 Podpod 0.0% 0 / 124 totaltotal 17.1% 1308 / 7641 CC 2201 SCAR 62.6
CC
2201
Cov
18%
prereq_pm
1963.7
prereq_pm
1963.7
prepare
1908.9
CRAP 521.2
« blib/lib/CPAN/Tarzip.pm ↑ Summary lib/CPAN/Admin.pm »
1 # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*-
2 # vim: ts=4 sts=4 sw=4:
3 package CPAN::Distribution;
4 26 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 26 ▶use Cwd qw(chdir);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 26 ▶use CPAN::Distroprefs;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 26 ▶use CPAN::InfoObj;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 26 ▶use File::Path ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 26 ▶use POSIX ":sys_wait_h";
Subroutine BEGIN: called CC=1 SCAR=0.0
10 26 @CPAN::Distribution::ISA = qw(CPAN::InfoObj);
11 26 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 26 $VERSION = "2.39";
13  
14 26 my $run_allow_installing_within_test = 1; # boolean; either in test or in install, there is no third option
15  
16 # no prepare, because prepare is not a command on the shell command line
17 # TODO: clear instance cache on reload
18 26 my %instance;
19 26 for my $method (qw(get make test install)) {
20 26 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
21 104 for my $prefix (qw(pre post)) {
22 208 my $hookname = sprintf "%s_%s", $prefix, $method;
23 52 ▶ *$hookname = sub {
Subroutine __ANON__: called CC=6 SCAR=35.4
24 0 ▶ my($self) = @_;
Subroutine __ANON__: not called CC=6 SCAR=35.4
25 0 for my $plugin (@{$CPAN::Config->{plugin_list}}) {
26 0 my($plugin_proper,$args) = split /=/, $plugin, 2;
27 0 ▶ $args = "" unless defined $args;
Branch: 2 branches
BranchTrueFalseTotal
unless defined $args 0 0 0
unless defined $args 0 0 0
28 0 ▶ if ($CPAN::META->has_inst($plugin_proper)){
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::META->has_inst($plugin_proper)) { } 0 0 0
if ($CPAN::META->has_inst($plugin_proper)) { } 0 0 0
29 0 my @args = split /,/, $args;
30 0 ▶ $instance{$plugin} ||= $plugin_proper->new(@args);
Condition0%0/6
$instance{$plugin} ||= $plugin_proper->new(@args)
l!l&&r!l&&!r
000
$instance{$plugin} ||= $plugin_proper->new(@args)
l!l&&r!l&&!r
000
MC/DC0%0/2
$instance{$plugin} ||= $plugin_proper->new(@args)
$instance{$plugin} $plugin_proper->new(@args)
MC/DC0%0/2
$instance{$plugin} ||= $plugin_proper->new(@args)
$instance{$plugin} $plugin_proper->new(@args)
Truth table0%0/3
A ||= B
A= $instance{$plugin}B= $plugin_proper->new(@args)
ABresult
1X1
011
000
Truth table0%0/3
A ||= B
A= $instance{$plugin}B= $plugin_proper->new(@args)
ABresult
1X1
011
000
31 0 ▶ if ($instance{$plugin}->can($hookname)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($instance{$plugin}->can($hookname)) 0 0 0
if ($instance{$plugin}->can($hookname)) 0 0 0
32 0 $instance{$plugin}->$hookname($self);
33 }
34 } else {
35 0 $CPAN::Frontend->mydie("Plugin '$plugin_proper' not found for hook '$hookname'");
36 }
37 }
38 208 };
39 }
40 }
41  
42 # Accessors
43 8 ▶sub cpan_comment {
Subroutine cpan_comment: called CC=2 SCAR=9.2
Pod undocumented
44 0 ▶ my $self = shift;
Subroutine cpan_comment: not called CC=2 SCAR=9.2
Pod undocumented
45 0 ▶ my $ro = $self->ro or return;
Branch: 2 branches
BranchTrueFalseTotal
my $ro = $self->ro or return 7 1 8
my $ro = $self->ro or return 0 0 0
46 $ro->{CPAN_COMMENT}
47 0 }
48  
49 #-> CPAN::Distribution::undelay
50 5 ▶sub undelay {
Subroutine undelay: called CC=2 SCAR=9.2
Pod undocumented
51 0 ▶ my $self = shift;
Subroutine undelay: not called CC=2 SCAR=9.2
Pod undocumented
52 0 for my $delayer (
53 "configure_requires_later",
54 "configure_requires_later_for",
55 "later",
56 "later_for",
57 ) {
58 0 delete $self->{$delayer};
59 }
60 }
61  
62 #-> CPAN::Distribution::is_dot_dist
63 21 ▶sub is_dot_dist {
Subroutine is_dot_dist: called CC=1 SCAR=1.2
Pod undocumented
64 0 ▶ my($self) = @_;
Subroutine is_dot_dist: not called CC=1 SCAR=1.2
Pod undocumented
65 0 return substr($self->id,-1,1) eq ".";
66 }
67  
68 # add the A/AN/ stuff
69 #-> CPAN::Distribution::normalize
70 25 ▶sub normalize {
Subroutine normalize: called CC=15 SCAR=52.4
Pod undocumented
71 0 ▶ my($self,$s) = @_;
Subroutine normalize: not called CC=15 SCAR=52.4
Pod undocumented
72 0 ▶ $s = $self->id unless defined $s;
Branch: 2 branches
BranchTrueFalseTotal
unless defined $s 0 25 25
unless defined $s 0 0 0
73 0 ▶ if (substr($s,-1,1) eq ".") {
Branch: 4 branches
BranchTrueFalseTotal
if (substr($s, -1, 1) eq '.') { } 0 25 25
elsif ($s =~ tr[/][] == 1 or not $s =~ m[[A-Z]/[A-Z-0-9]{2}/[A-Z-0-9]{2,}/]) { } 0 25 25
if (substr($s, -1, 1) eq '.') { } 0 0 0
elsif ($s =~ tr[/][] == 1 or not $s =~ m[[A-Z]/[A-Z-0-9]{2}/[A-Z-0-9]{2,}/]) { } 0 0 0
74 # using a global because we are sometimes called as static method
75 0 ▶ if (!$CPAN::META->{LOCK}
Branch: 2 branches
BranchTrueFalseTotal
unless ($CPAN::META->{"LOCK"} or $$CPAN::Have_warned{"$s is unlocked"}++) 0 0 0
unless ($CPAN::META->{"LOCK"} or $$CPAN::Have_warned{"$s is unlocked"}++) 0 0 0
Condition0%0/6
$CPAN::META->{"LOCK"} or $$CPAN::Have_warned{"$s is unlocked"}++
l!l&&r!l&&!r
000
$CPAN::META->{"LOCK"} or $$CPAN::Have_warned{"$s is unlocked"}++
l!l&&r!l&&!r
000
MC/DC0%0/2
$CPAN::META->{"LOCK"} or $$CPAN::Have_warned{"$s is unlocked"}++
$CPAN::META->{"LOCK"} $$CPAN::Have_warned{"$s is unlocked"}++
MC/DC0%0/2
$CPAN::META->{"LOCK"} or $$CPAN::Have_warned{"$s is unlocked"}++
$CPAN::META->{"LOCK"} $$CPAN::Have_warned{"$s is unlocked"}++
Truth table0%0/3
A or B
A= $CPAN::META->{"LOCK"}B= $$CPAN::Have_warned{"$s is unlocked"}++
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= $CPAN::META->{"LOCK"}B= $$CPAN::Have_warned{"$s is unlocked"}++
ABresult
1X1
011
000
76 && !$CPAN::Have_warned->{"$s is unlocked"}++
77 ) {
78 0 $CPAN::Frontend->mywarn("You are visiting the local directory
79 '$s'
80 without lock, take care that concurrent processes do not do likewise.\n");
81 0 $CPAN::Frontend->mysleep(1);
82 }
83 0 ▶ if ($s eq ".") {
Branch: 6 branches
BranchTrueFalseTotal
if ($s eq '.') { } 0 0 0
elsif ('File::Spec'->file_name_is_absolute($s)) { } 0 0 0
elsif ('File::Spec'->can('rel2abs')) { } 0 0 0
if ($s eq '.') { } 0 0 0
elsif ('File::Spec'->file_name_is_absolute($s)) { } 0 0 0
elsif ('File::Spec'->can('rel2abs')) { } 0 0 0
84 0 $s = "$CPAN::iCwd/.";
85 } elsif (File::Spec->file_name_is_absolute($s)) {
86 } elsif (File::Spec->can("rel2abs")) {
87 0 $s = File::Spec->rel2abs($s);
88 } else {
89 0 $CPAN::Frontend->mydie("Your File::Spec is too old, please upgrade File::Spec");
90 }
91 0 ▶ CPAN->debug("s[$s]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
92 0 ▶ unless ($CPAN::META->exists("CPAN::Distribution", $s)) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($CPAN::META->exists("CPAN::Distribution", $s)) 0 0 0
unless ($CPAN::META->exists("CPAN::Distribution", $s)) 0 0 0
93 0 for ($CPAN::META->instance("CPAN::Distribution", $s)) {
94 0 $_->{build_dir} = $s;
95 0 $_->{archived} = "local_directory";
96 0 $_->{unwrapped} = CPAN::Distrostatus->new("YES -- local_directory");
97 }
98 }
99 ▶ } elsif (
Condition16%1/6
$s =~ tr[/][] == 1 or not $s =~ m[[A-Z]/[A-Z-0-9]{2}/[A-Z-0-9]{2,}/]
l!l&&r!l&&!r
0025
$s =~ tr[/][] == 1 or not $s =~ m[[A-Z]/[A-Z-0-9]{2}/[A-Z-0-9]{2,}/]
l!l&&r!l&&!r
000
MC/DC0%0/2
$s =~ tr[/][] == 1 or not $s =~ m[[A-Z]/[A-Z-0-9]{2}/[A-Z-0-9]{2,}/]
$s =~ tr[/][] == 1 not $s =~ m[[A-Z]/[A-Z-0-9]{2}/[A-Z-0-9]{2,}/]
MC/DC0%0/2
$s =~ tr[/][] == 1 or not $s =~ m[[A-Z]/[A-Z-0-9]{2}/[A-Z-0-9]{2,}/]
$s =~ tr[/][] == 1 not $s =~ m[[A-Z]/[A-Z-0-9]{2}/[A-Z-0-9]{2,}/]
Truth table33%1/3
A or not(B)
A= $s =~ tr[/][] == 1B= not $s =~ m[[A-Z]/[A-Z-0-9]{2}/[A-Z-0-9]{2,}/]
ABresult
1X1
011
000
Truth table0%0/3
A or not(B)
A= $s =~ tr[/][] == 1B= not $s =~ m[[A-Z]/[A-Z-0-9]{2}/[A-Z-0-9]{2,}/]
ABresult
1X1
011
000
100 $s =~ tr|/|| == 1
101 or
102 $s !~ m|[A-Z]/[A-Z-0-9]{2}/[A-Z-0-9]{2,}/|
103 ) {
104 0 ▶ return $s if $s =~ m:^N/A|^Contact Author: ;
Branch: 2 branches
BranchTrueFalseTotal
if $s =~ m[^N/A|^Contact Author] 0 0 0
if $s =~ m[^N/A|^Contact Author] 0 0 0
105 0 $s =~ s|^(.)(.)([^/]*/)(.+)$|$1/$1$2/$1$2$3$4|;
106 0 ▶ CPAN->debug("s[$s]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
107 }
108 0 $s;
109 }
110  
111 #-> sub CPAN::Distribution::author ;
112 1 ▶sub author {
Subroutine author: called CC=2 SCAR=10.9
Pod undocumented
113 0 ▶ my($self) = @_;
Subroutine author: not called CC=2 SCAR=10.9
Pod undocumented
114 0 my($authorid);
115 0 ▶ if (substr($self->id,-1,1) eq ".") {
Branch: 2 branches
BranchTrueFalseTotal
if (substr($self->id, -1, 1) eq '.') { } 0 1 1
if (substr($self->id, -1, 1) eq '.') { } 0 0 0
116 0 $authorid = "LOCAL";
117 } else {
118 0 ($authorid) = $self->pretty_id =~ /^([\w\-]+)/;
119 }
120 0 CPAN::Shell->expand("Author",$authorid);
121 }
122  
123 # tries to get the yaml from CPAN instead of the distro itself:
124 # EXPERIMENTAL, UNDOCUMENTED AND UNTESTED, for Tels
125 0 ▶sub fast_yaml {
Subroutine fast_yaml: not called CC=3 SCAR=24.8
Pod undocumented
126 0 ▶ my($self) = @_;
Subroutine fast_yaml: not called CC=3 SCAR=24.8
Pod undocumented
127 0 my $meta = $self->pretty_id;
128 0 $meta =~ s/\.(tar.gz|tgz|zip|tar.bz2)/.meta/;
129 0 my(@ls) = CPAN::Shell->globls($meta);
130 0 my $norm = $self->normalize($meta);
131  
132 0 my($local_file);
133 my($local_wanted) =
134 File::Spec->catfile(
135 $CPAN::Config->{keep_source_where},
136 0 "authors",
137 "id",
138 split(/\//,$norm)
139 );
140 0 ▶ $self->debug("Doing localize") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
141 0 ▶ unless ($local_file =
Branch: 2 branches
BranchTrueFalseTotal
unless ($local_file = "CPAN::FTP"->localize("authors/id/$norm", $local_wanted)) 0 0 0
unless ($local_file = "CPAN::FTP"->localize("authors/id/$norm", $local_wanted)) 0 0 0
142 CPAN::FTP->localize("authors/id/$norm",
143 $local_wanted)) {
144 0 $CPAN::Frontend->mydie("Giving up on downloading yaml file '$local_wanted'\n");
145 }
146 0 my $yaml = CPAN->_yaml_loadfile($local_file)->[0];
147 }
148  
149 #-> sub CPAN::Distribution::cpan_userid
150 0 ▶sub cpan_userid {
Subroutine cpan_userid: not called CC=2 SCAR=17.9
Pod undocumented
151 0 ▶ my $self = shift;
Subroutine cpan_userid: not called CC=2 SCAR=17.9
Pod undocumented
152 0 ▶ if ($self->{ID} =~ m{[A-Z]/[A-Z\-]{2}/([A-Z\-]+)/}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{"ID"} =~ m[[A-Z]/[A-Z\-]{2}/([A-Z\-]+)/]) 0 0 0
if ($self->{"ID"} =~ m[[A-Z]/[A-Z\-]{2}/([A-Z\-]+)/]) 0 0 0
153 0 return $1;
154 }
155 0 return $self->SUPER::cpan_userid;
156 }
157  
158 #-> sub CPAN::Distribution::pretty_id
159 31 ▶sub pretty_id {
Subroutine pretty_id: called CC=2 SCAR=10.3
Pod undocumented
160 0 ▶ my $self = shift;
Subroutine pretty_id: not called CC=2 SCAR=10.3
Pod undocumented
161 0 my $id = $self->id;
162 0 ▶ return $id unless $id =~ m|^./../|;
Branch: 2 branches
BranchTrueFalseTotal
unless $id =~ m[^./../] 0 31 31
unless $id =~ m[^./../] 0 0 0
163 0 substr($id,5);
164 }
165  
166 #-> sub CPAN::Distribution::base_id
167 6 ▶sub base_id {
Subroutine base_id: called CC=1 SCAR=1.2
Pod undocumented
168 0 ▶ my $self = shift;
Subroutine base_id: not called CC=1 SCAR=1.2
Pod undocumented
169 0 my $id = $self->pretty_id();
170 0 my $base_id = File::Basename::basename($id);
171 0 $base_id =~ s{\.(?:tar\.(bz2|gz|Z)|t(?:gz|bz)|zip)$}{}i;
172 0 return $base_id;
173 }
174  
175 #-> sub CPAN::Distribution::tested_ok_but_not_installed
176 0 ▶sub tested_ok_but_not_installed {
Subroutine tested_ok_but_not_installed: not called CC=6 SCAR=37.4
Pod undocumented
177 0 ▶ my $self = shift;
Subroutine tested_ok_but_not_installed: not called CC=6 SCAR=37.4
Pod undocumented
178 return (
179 $self->{make_test}
180 && $self->{build_dir}
181 && (UNIVERSAL::can($self->{make_test},"failed") ?
182 ! $self->{make_test}->failed :
183 $self->{make_test} =~ /^YES/
184 )
185 && (
186 !$self->{install}
187 ||
188 $self->{install}->failed
189 )
190 0 ▶ );
Branch: 2 branches
BranchTrueFalseTotal
UNIVERSAL::can($self->{'make_test'}, 'failed') ? : 0 0 0
UNIVERSAL::can($self->{'make_test'}, 'failed') ? : 0 0 0
Condition0%0/24
$self->{'make_test'} && $self->{'build_dir'} && (UNIVERSAL::can($self->{'make_test'}, 'failed') ? !$self->{'make_test'}->failed : $self->{'make_test'} =~ /^YES/) && (!$self->{'install'} || $self->{'install'}->failed)
!ll&&!rl&&r
000
$self->{"make_test"} and $self->{"build_dir"} and UNIVERSAL::can($self->{"make_test"}, "failed") ? !$self->{"make_test"}->failed : $self->{"make_test"} =~ /^YES/
!ll&&!rl&&r
000
$self->{"make_test"} and $self->{"build_dir"}
!ll&&!rl&&r
000
not $self->{"install"} or $self->{"install"}->failed
l!l&&r!l&&!r
000
$self->{'make_test'} && $self->{'build_dir'} && (UNIVERSAL::can($self->{'make_test'}, 'failed') ? !$self->{'make_test'}->failed : $self->{'make_test'} =~ /^YES/) && (!$self->{'install'} || $self->{'install'}->failed)
!ll&&!rl&&r
000
$self->{"make_test"} and $self->{"build_dir"} and UNIVERSAL::can($self->{"make_test"}, "failed") ? !$self->{"make_test"}->failed : $self->{"make_test"} =~ /^YES/
!ll&&!rl&&r
000
$self->{"make_test"} and $self->{"build_dir"}
!ll&&!rl&&r
000
not $self->{"install"} or $self->{"install"}->failed
l!l&&r!l&&!r
000
MC/DC0%0/5
$self->{'make_test'} && $self->{'build_dir'} && (UNIVERSAL::can($self->{'make_test'}, 'failed') ? !$self->{'make_test'}->failed : $self->{'make_test'} =~ /^YES/) && (!$self->{'install'} || $self->{'install'}->failed)
$self->{"make_test"} $self->{"build_dir"} UNIVERSAL::can($self->{"make_test"}, "failed") ? !$self->{"make_test"}->failed : $self->{"make_test"} =~ /^YES/ not $self->{"install"} $self->{"install"}->failed
MC/DC0%0/5
$self->{'make_test'} && $self->{'build_dir'} && (UNIVERSAL::can($self->{'make_test'}, 'failed') ? !$self->{'make_test'}->failed : $self->{'make_test'} =~ /^YES/) && (!$self->{'install'} || $self->{'install'}->failed)
$self->{"make_test"} $self->{"build_dir"} UNIVERSAL::can($self->{"make_test"}, "failed") ? !$self->{"make_test"}->failed : $self->{"make_test"} =~ /^YES/ not $self->{"install"} $self->{"install"}->failed
Truth table0%0/6
A and B and C && not(D) or E
A= $self->{"make_test"}B= $self->{"build_dir"}C= UNIVERSAL::can($self->{"make_test"}, "failed") ? !$self->{"make_test"}->failed : $self->{"make_test"} =~ /^YES/D= not $self->{"install"}E= $self->{"install"}->failed
ABCDEresult
0XXXX0
10XXX0
110XX0
111000
1111X1
111011
Truth table0%0/6
A and B and C && not(D) or E
A= $self->{"make_test"}B= $self->{"build_dir"}C= UNIVERSAL::can($self->{"make_test"}, "failed") ? !$self->{"make_test"}->failed : $self->{"make_test"} =~ /^YES/D= not $self->{"install"}E= $self->{"install"}->failed
ABCDEresult
0XXXX0
10XXX0
110XX0
111000
1111X1
111011
191 }
192  
193  
194 # mark as dirty/clean for the sake of recursion detection. $color=1
195 # means "in use", $color=0 means "not in use anymore". $color=2 means
196 # we have determined prereqs now and thus insist on passing this
197 # through (at least) once again.
198  
199 #-> sub CPAN::Distribution::color_cmd_tmps ;
200 12 ▶sub color_cmd_tmps {
Subroutine color_cmd_tmps: called CC=18 SCAR=47.8
Pod undocumented
201 0 ▶ my($self) = shift;
Subroutine color_cmd_tmps: not called CC=18 SCAR=47.8
Pod undocumented
202 0 ▶ my($depth) = shift || 0;
Condition25%1/4
shift() || 0
l!l
120
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
Truth table0%0/2
A
A= shift()
Aresult
11
00
203 0 ▶ my($color) = shift || 0;
Condition50%2/4
shift() || 0
l!l
75
shift() || 0
l!l
00
MC/DC100%1/1
shift() || 0
shift()
MC/DC0%0/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
Truth table0%0/2
A
A= shift()
Aresult
11
00
204 0 ▶ my($ancestors) = shift || [];
Condition25%1/4
shift() || []
l!l
120
shift() || []
l!l
00
MC/DC0%0/1
shift() || []
shift()
MC/DC0%0/1
shift() || []
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
Truth table0%0/2
A
A= shift()
Aresult
11
00
205 # a distribution needs to recurse into its prereq_pms
206 0 ▶ $self->debug("color_cmd_tmps[$depth,$color,@$ancestors]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 12 12
if $CPAN::DEBUG 0 0 0
207  
208 return if exists $self->{incommandcolor}
209 && $color==1
210 0 ▶ && $self->{incommandcolor}==$color;
Branch: 2 branches
BranchTrueFalseTotal
if exists $self->{"incommandcolor"} and $color == 1 and $self->{"incommandcolor"} == $color 0 12 12
if exists $self->{"incommandcolor"} and $color == 1 and $self->{"incommandcolor"} == $color 0 0 0
Condition25%3/12
exists $self->{"incommandcolor"} and $color == 1 and $self->{"incommandcolor"} == $color
!ll&&!rl&&r
1200
exists $self->{"incommandcolor"} and $color == 1
!ll&&!rl&&r
750
exists $self->{"incommandcolor"} and $color == 1 and $self->{"incommandcolor"} == $color
!ll&&!rl&&r
000
exists $self->{"incommandcolor"} and $color == 1
!ll&&!rl&&r
000
MC/DC0%0/3
exists $self->{"incommandcolor"} and $color == 1 and $self->{"incommandcolor"} == $color
exists $self->{"incommandcolor"} $color == 1 $self->{"incommandcolor"} == $color
MC/DC0%0/3
exists $self->{"incommandcolor"} and $color == 1 and $self->{"incommandcolor"} == $color
exists $self->{"incommandcolor"} $color == 1 $self->{"incommandcolor"} == $color
Truth table50%2/4
A and B and C
A= exists $self->{"incommandcolor"}B= $color == 1C= $self->{"incommandcolor"} == $color
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and B and C
A= exists $self->{"incommandcolor"}B= $color == 1C= $self->{"incommandcolor"} == $color
ABCresult
0XX0
10X0
1100
1111
211 0 ▶ $CPAN::MAX_RECURSION||=0; # silence 'once' warnings
Condition25%1/4
$CPAN::MAX_RECURSION ||= 0
l!l
120
$CPAN::MAX_RECURSION ||= 0
l!l
00
MC/DC0%0/1
$CPAN::MAX_RECURSION ||= 0
$CPAN::MAX_RECURSION
MC/DC0%0/1
$CPAN::MAX_RECURSION ||= 0
$CPAN::MAX_RECURSION
Truth table50%1/2
A
A= $CPAN::MAX_RECURSION
Aresult
11
00
Truth table0%0/2
A
A= $CPAN::MAX_RECURSION
Aresult
11
00
212 0 ▶ if ($depth>=$CPAN::MAX_RECURSION) {
Branch: 2 branches
BranchTrueFalseTotal
if ($depth >= $CPAN::MAX_RECURSION) 0 12 12
if ($depth >= $CPAN::MAX_RECURSION) 0 0 0
213 0 my $e = CPAN::Exception::RecursiveDependency->new($ancestors);
214 0 ▶ if ($e->is_resolvable) {
Branch: 2 branches
BranchTrueFalseTotal
if ($e->is_resolvable) { } 0 0 0
if ($e->is_resolvable) { } 0 0 0
215 0 return $self->{incommandcolor}=2;
216 } else {
217 0 die $e;
218 }
219 }
220 # warn "color_cmd_tmps $depth $color " . $self->id; # sleep 1;
221 0 my $prereq_pm = $self->prereq_pm;
222 0 ▶ if (defined $prereq_pm) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $prereq_pm) 2 10 12
if (defined $prereq_pm) 0 0 0
223 # XXX also optional_req & optional_breq? -- xdg, 2012-04-01
224 # A: no, optional deps may recurse -- ak, 2014-05-07
225 0 PREREQ: for my $pre (sort(
226 0 ▶ keys %{$prereq_pm->{requires}||{}},
Condition25%1/4
$prereq_pm->{'requires'} || {}
l!l
20
$prereq_pm->{'requires'} || {}
l!l
00
MC/DC0%0/1
$prereq_pm->{'requires'} || {}
$prereq_pm->{'requires'}
MC/DC0%0/1
$prereq_pm->{'requires'} || {}
$prereq_pm->{'requires'}
Truth table50%1/2
A
A= $prereq_pm->{'requires'}
Aresult
11
00
Truth table0%0/2
A
A= $prereq_pm->{'requires'}
Aresult
11
00
227 0 ▶ keys %{$prereq_pm->{build_requires}||{}},
Condition25%1/4
$prereq_pm->{'build_requires'} || {}
l!l
20
$prereq_pm->{'build_requires'} || {}
l!l
00
MC/DC0%0/1
$prereq_pm->{'build_requires'} || {}
$prereq_pm->{'build_requires'}
MC/DC0%0/1
$prereq_pm->{'build_requires'} || {}
$prereq_pm->{'build_requires'}
Truth table50%1/2
A
A= $prereq_pm->{'build_requires'}
Aresult
11
00
Truth table0%0/2
A
A= $prereq_pm->{'build_requires'}
Aresult
11
00
228 )) {
229 0 ▶ next PREREQ if $pre eq "perl";
Branch: 2 branches
BranchTrueFalseTotal
if $pre eq "perl" 0 4 4
if $pre eq "perl" 0 0 0
230 0 my $premo;
231 0 ▶ unless ($premo = CPAN::Shell->expand("Module",$pre)) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($premo = "CPAN::Shell"->expand("Module", $pre)) 0 4 4
unless ($premo = "CPAN::Shell"->expand("Module", $pre)) 0 0 0
232 0 $CPAN::Frontend->mywarn("prerequisite module[$pre] not known\n");
233 0 $CPAN::Frontend->mysleep(0.2);
234 0 next PREREQ;
235 }
236 0 $premo->color_cmd_tmps($depth+1,$color,[@$ancestors, $self->id]);
237 }
238 }
239 0 ▶ if ($color==0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($color == 0) 5 7 12
if ($color == 0) 0 0 0
240 0 delete $self->{sponsored_mods};
241  
242 # as we are at the end of a command, we'll give up this
243 # reminder of a broken test. Other commands may test this guy
244 # again. Maybe 'badtestcnt' should be renamed to
245 # 'make_test_failed_within_command'?
246 0 delete $self->{badtestcnt};
247 }
248 0 $self->{incommandcolor} = $color;
249 }
250  
251 #-> sub CPAN::Distribution::as_string ;
252 0 ▶sub as_string {
Subroutine as_string: not called CC=1 SCAR=6.9
Pod undocumented
253 0 ▶ my $self = shift;
Subroutine as_string: not called CC=1 SCAR=6.9
Pod undocumented
254 0 $self->containsmods;
255 0 $self->upload_date;
256 0 $self->SUPER::as_string(@_);
257 }
258  
259 #-> sub CPAN::Distribution::containsmods ;
260 0 ▶sub containsmods {
Subroutine containsmods: not called CC=8 SCAR=42.8
Pod undocumented
261 0 ▶ my $self = shift;
Subroutine containsmods: not called CC=8 SCAR=42.8
Pod undocumented
262 0 ▶ return sort keys %{$self->{CONTAINSMODS}} if exists $self->{CONTAINSMODS};
Branch: 2 branches
BranchTrueFalseTotal
if exists $self->{"CONTAINSMODS"} 0 0 0
if exists $self->{"CONTAINSMODS"} 0 0 0
263 0 my $dist_id = $self->{ID};
264 0 for my $mod ($CPAN::META->all_objects("CPAN::Module")) {
265 0 ▶ my $mod_file = $mod->cpan_file or next;
Branch: 2 branches
BranchTrueFalseTotal
my $mod_file = $mod->cpan_file or next 0 0 0
my $mod_file = $mod->cpan_file or next 0 0 0
266 0 ▶ my $mod_id = $mod->{ID} or next;
Branch: 2 branches
BranchTrueFalseTotal
my $mod_id = $mod->{"ID"} or next 0 0 0
my $mod_id = $mod->{"ID"} or next 0 0 0
267 # warn "mod_file[$mod_file] dist_id[$dist_id] mod_id[$mod_id]";
268 # sleep 1;
269 0 ▶ if ($CPAN::Signal) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Signal) 0 0 0
if ($CPAN::Signal) 0 0 0
270 0 delete $self->{CONTAINSMODS};
271 0 return;
272 }
273 0 ▶ $self->{CONTAINSMODS}{$mod_id} = undef if $mod_file eq $dist_id;
Branch: 2 branches
BranchTrueFalseTotal
if $mod_file eq $dist_id 0 0 0
if $mod_file eq $dist_id 0 0 0
274 }
275 0 ▶ sort keys %{$self->{CONTAINSMODS}||={}};
Condition0%0/4
$self->{"CONTAINSMODS"} ||= {}
l!l
00
$self->{"CONTAINSMODS"} ||= {}
l!l
00
MC/DC0%0/1
$self->{"CONTAINSMODS"} ||= {}
$self->{"CONTAINSMODS"}
MC/DC0%0/1
$self->{"CONTAINSMODS"} ||= {}
$self->{"CONTAINSMODS"}
Truth table0%0/2
A
A= $self->{"CONTAINSMODS"}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"CONTAINSMODS"}
Aresult
11
00
276 }
277  
278 #-> sub CPAN::Distribution::upload_date ;
279 0 ▶sub upload_date {
Subroutine upload_date: not called CC=5 SCAR=34.0
Pod undocumented
280 0 ▶ my $self = shift;
Subroutine upload_date: not called CC=5 SCAR=34.0
Pod undocumented
281 0 ▶ return $self->{UPLOAD_DATE} if exists $self->{UPLOAD_DATE};
Branch: 2 branches
BranchTrueFalseTotal
if exists $self->{"UPLOAD_DATE"} 0 0 0
if exists $self->{"UPLOAD_DATE"} 0 0 0
282 0 my(@local_wanted) = split(/\//,$self->id);
283 0 my $filename = pop @local_wanted;
284 0 push @local_wanted, "CHECKSUMS";
285 0 my $author = CPAN::Shell->expand("Author",$self->cpan_userid);
286 0 ▶ return unless $author;
Branch: 2 branches
BranchTrueFalseTotal
unless $author 0 0 0
unless $author 0 0 0
287 0 my @dl = $author->dir_listing(\@local_wanted,0,$CPAN::Config->{show_upload_date});
288 0 ▶ return unless @dl;
Branch: 2 branches
BranchTrueFalseTotal
unless @dl 0 0 0
unless @dl 0 0 0
289 0 my($dirent) = grep { $_->[2] eq $filename } @dl;
290 # warn sprintf "dirent[%s]id[%s]", $dirent, $self->id;
291 0 ▶ return unless $dirent->[1];
Branch: 2 branches
BranchTrueFalseTotal
unless $dirent->[1] 0 0 0
unless $dirent->[1] 0 0 0
292 0 return $self->{UPLOAD_DATE} = $dirent->[1];
293 }
294  
295 #-> sub CPAN::Distribution::uptodate ;
296 0 ▶sub uptodate {
Subroutine uptodate: not called CC=4 SCAR=30.0
Pod undocumented
297 0 ▶ my($self) = @_;
Subroutine uptodate: not called CC=4 SCAR=30.0
Pod undocumented
298 0 my $c;
299 0 foreach $c ($self->containsmods) {
300 0 my $obj = CPAN::Shell->expandany($c);
301 0 ▶ unless ($obj->uptodate) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($obj->uptodate) 0 0 0
unless ($obj->uptodate) 0 0 0
302 0 my $id = $self->pretty_id;
303 0 ▶ $self->debug("$id not uptodate due to $c") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
304 0 return 0;
305 }
306 }
307 0 return 1;
308 }
309  
310 #-> sub CPAN::Distribution::called_for ;
311 7 ▶sub called_for {
Subroutine called_for: called CC=2 SCAR=10.5
Pod undocumented
312 0 ▶ my($self,$id) = @_;
Subroutine called_for: not called CC=2 SCAR=10.5
Pod undocumented
313 0 ▶ $self->{CALLED_FOR} = $id if defined $id;
Branch: 2 branches
BranchTrueFalseTotal
if defined $id 7 0 7
if defined $id 0 0 0
314 0 return $self->{CALLED_FOR};
315 }
316  
317 #-> sub CPAN::Distribution::shortcut_get ;
318 # return values: undef means don't shortcut; 0 means shortcut as fail;
319 # and 1 means shortcut as success
320 7 ▶sub shortcut_get {
Subroutine shortcut_get: called CC=15 SCAR=48.6
Pod undocumented
321 0 ▶ my ($self) = @_;
Subroutine shortcut_get: not called CC=15 SCAR=48.6
Pod undocumented
322  
323 0 ▶ if (exists $self->{cleanup_after_install_done}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $self->{"cleanup_after_install_done"}) 0 7 7
if (exists $self->{"cleanup_after_install_done"}) 0 0 0
324 0 ▶ if ($self->{force_update}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'force_update'}) { } 0 0 0
if ($self->{'force_update'}) { } 0 0 0
325 0 delete $self->{cleanup_after_install_done};
326 } else {
327 0 ▶ my $id = $self->{CALLED_FOR} || $self->pretty_id;
Condition0%0/6
$self->{'CALLED_FOR'} || $self->pretty_id
l!l&&r!l&&!r
000
$self->{'CALLED_FOR'} || $self->pretty_id
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'CALLED_FOR'} || $self->pretty_id
$self->{'CALLED_FOR'} $self->pretty_id
MC/DC0%0/2
$self->{'CALLED_FOR'} || $self->pretty_id
$self->{'CALLED_FOR'} $self->pretty_id
Truth table0%0/3
A || B
A= $self->{'CALLED_FOR'}B= $self->pretty_id
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $self->{'CALLED_FOR'}B= $self->pretty_id
ABresult
1X1
011
000
328 0 return $self->success(
329 "Has already been *installed and cleaned up in the staging area* within this session, will not work on it again; if you really want to start over, try something like `force get $id`"
330 );
331 }
332 }
333  
334 0 ▶ if (my $why = $self->check_disabled) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $why = $self->check_disabled) 0 7 7
if (my $why = $self->check_disabled) 0 0 0
335 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO $why");
336 # XXX why is this goodbye() instead of just print/warn?
337 # Alternatively, should other print/warns here be goodbye()?
338 # -- xdg, 2012-04-05
339 0 return $self->goodbye("[disabled] -- NA $why");
340 }
341  
342 0 ▶ $self->debug("checking already unwrapped[$self->{ID}]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
343 0 ▶ if (exists $self->{build_dir} && -d $self->{build_dir}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $self->{"build_dir"} and -d $self->{"build_dir"}) 0 7 7
if (exists $self->{"build_dir"} and -d $self->{"build_dir"}) 0 0 0
Condition16%1/6
exists $self->{"build_dir"} and -d $self->{"build_dir"}
!ll&&!rl&&r
700
exists $self->{"build_dir"} and -d $self->{"build_dir"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"build_dir"} and -d $self->{"build_dir"}
exists $self->{"build_dir"} -d $self->{"build_dir"}
MC/DC0%0/2
exists $self->{"build_dir"} and -d $self->{"build_dir"}
exists $self->{"build_dir"} -d $self->{"build_dir"}
Truth table33%1/3
A and B
A= exists $self->{"build_dir"}B= -d $self->{"build_dir"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= exists $self->{"build_dir"}B= -d $self->{"build_dir"}
ABresult
0X0
100
111
344 # this deserves print, not warn:
345 0 return $self->success("Has already been unwrapped into directory ".
346 "$self->{build_dir}"
347 );
348 }
349  
350 # XXX I'm not sure this should be here because it's not really
351 # a test for whether get should continue or return; this is
352 # a side effect -- xdg, 2012-04-05
353 0 ▶ $self->debug("checking missing build_dir[$self->{ID}]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
354 0 ▶ if (exists $self->{build_dir} && ! -d $self->{build_dir}){
Branch: 2 branches
BranchTrueFalseTotal
if (exists $self->{"build_dir"} and not -d $self->{"build_dir"}) 0 7 7
if (exists $self->{"build_dir"} and not -d $self->{"build_dir"}) 0 0 0
Condition16%1/6
exists $self->{"build_dir"} and not -d $self->{"build_dir"}
!ll&&!rl&&r
700
exists $self->{"build_dir"} and not -d $self->{"build_dir"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"build_dir"} and not -d $self->{"build_dir"}
exists $self->{"build_dir"} not -d $self->{"build_dir"}
MC/DC0%0/2
exists $self->{"build_dir"} and not -d $self->{"build_dir"}
exists $self->{"build_dir"} not -d $self->{"build_dir"}
Truth table33%1/3
A and not(B)
A= exists $self->{"build_dir"}B= not -d $self->{"build_dir"}
ABresult
0X0
100
111
Truth table0%0/3
A and not(B)
A= exists $self->{"build_dir"}B= not -d $self->{"build_dir"}
ABresult
0X0
100
111
355 # we have lost it.
356 0 $self->fforce(""); # no method to reset all phases but not set force (dodge)
357 0 return undef; # no shortcut
358 }
359  
360 # although we talk about 'force' we shall not test on
361 # force directly. New model of force tries to refrain from
362 # direct checking of force.
363 0 ▶ $self->debug("checking unwrapping error[$self->{ID}]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
364 0 ▶ if ( exists $self->{unwrapped} and (
Branch: 4 branches
BranchTrueFalseTotal
if (exists $self->{"unwrapped"} and UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/) 0 7 7
UNIVERSAL::can($self->{'unwrapped'}, 'failed') ? : 0 0 0
if (exists $self->{"unwrapped"} and UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/) 0 0 0
UNIVERSAL::can($self->{'unwrapped'}, 'failed') ? : 0 0 0
Condition16%1/6
exists $self->{"unwrapped"} and UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
!ll&&!rl&&r
700
exists $self->{"unwrapped"} and UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"unwrapped"} and UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
exists $self->{"unwrapped"} UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
MC/DC0%0/2
exists $self->{"unwrapped"} and UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
exists $self->{"unwrapped"} UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
Truth table33%1/3
A and B
A= exists $self->{"unwrapped"}B= UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= exists $self->{"unwrapped"}B= UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
ABresult
0X0
100
111
365 UNIVERSAL::can($self->{unwrapped},"failed") ?
366 $self->{unwrapped}->failed :
367 $self->{unwrapped} =~ /^NO/ )
368 ) {
369 0 return $self->goodbye("Unwrapping had some problem, won't try again without force");
370 }
371  
372 0 return undef; # no shortcut
373 }
374  
375 #-> sub CPAN::Distribution::get ;
376 7 ▶sub get {
Subroutine get: called CC=18 SCAR=50.1
Pod undocumented
377 0 ▶ my($self) = @_;
Subroutine get: not called CC=18 SCAR=50.1
Pod undocumented
378  
379 0 $self->pre_get();
380  
381 0 ▶ $self->debug("checking goto id[$self->{ID}]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
382 0 ▶ if (my $goto = $self->prefs->{goto}) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $goto = $self->prefs->{"goto"}) 0 7 7
if (my $goto = $self->prefs->{"goto"}) 0 0 0
383 0 $self->post_get();
384 0 return $self->goto($goto);
385 }
386  
387 0 ▶ if ( defined( my $sc = $self->shortcut_get) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined(my $sc = $self->shortcut_get)) 0 7 7
if (defined(my $sc = $self->shortcut_get)) 0 0 0
388 0 $self->post_get();
389 0 return $sc;
390 }
391  
392 local $ENV{PERL5LIB} = defined($ENV{PERL5LIB})
393 ? $ENV{PERL5LIB}
394 0 ▶ : ($ENV{PERLLIB} || "");
Branch: 2 branches
BranchTrueFalseTotal
defined $ENV{'PERL5LIB'} ? : 7 0 7
defined $ENV{'PERL5LIB'} ? : 0 0 0
Condition0%0/4
$ENV{"PERLLIB"} or ""
l!l
00
$ENV{"PERLLIB"} or ""
l!l
00
MC/DC0%0/1
$ENV{"PERLLIB"} or ""
$ENV{"PERLLIB"}
MC/DC0%0/1
$ENV{"PERLLIB"} or ""
$ENV{"PERLLIB"}
Truth table0%0/2
A
A= $ENV{"PERLLIB"}
Aresult
11
00
Truth table0%0/2
A
A= $ENV{"PERLLIB"}
Aresult
11
00
395 0 ▶ local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : "";
Branch: 2 branches
BranchTrueFalseTotal
defined $ENV{'PERL5OPT'} ? : 7 0 7
defined $ENV{'PERL5OPT'} ? : 0 0 0
396 # local $ENV{PERL_USE_UNSAFE_INC} = exists $ENV{PERL_USE_UNSAFE_INC} ? $ENV{PERL_USE_UNSAFE_INC} : 1; # get
397 0 $CPAN::META->set_perl5lib;
398 0 local $ENV{MAKEFLAGS}; # protect us from outer make calls
399  
400 0 my $sub_wd = CPAN::anycwd(); # for cleaning up as good as possible
401  
402 0 my($local_file);
403 # XXX I don't think this check needs to be here, as it
404 # is already checked in shortcut_get() -- xdg, 2012-04-05
405 0 ▶ unless ($self->{build_dir} && -d $self->{build_dir}) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($self->{"build_dir"} and -d $self->{"build_dir"}) 7 0 7
unless ($self->{"build_dir"} and -d $self->{"build_dir"}) 0 0 0
Condition16%1/6
$self->{"build_dir"} and -d $self->{"build_dir"}
!ll&&!rl&&r
700
$self->{"build_dir"} and -d $self->{"build_dir"}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"build_dir"} and -d $self->{"build_dir"}
$self->{"build_dir"} -d $self->{"build_dir"}
MC/DC0%0/2
$self->{"build_dir"} and -d $self->{"build_dir"}
$self->{"build_dir"} -d $self->{"build_dir"}
Truth table33%1/3
A and B
A= $self->{"build_dir"}B= -d $self->{"build_dir"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $self->{"build_dir"}B= -d $self->{"build_dir"}
ABresult
0X0
100
111
406 0 $self->get_file_onto_local_disk;
407 0 ▶ if ($CPAN::Signal){
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Signal) 0 7 7
if ($CPAN::Signal) 0 0 0
408 0 $self->post_get();
409 0 return;
410 }
411 0 $self->check_integrity;
412 0 ▶ if ($CPAN::Signal){
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Signal) 0 7 7
if ($CPAN::Signal) 0 0 0
413 0 $self->post_get();
414 0 return;
415 }
416 0 (my $packagedir,$local_file) = $self->run_preps_on_packagedir;
417 # XXX why is this check here? -- xdg, 2012-04-08
418 0 ▶ if (exists $self->{writemakefile} && ref $self->{writemakefile}
Branch: 2 branches
BranchTrueFalseTotal
if (exists $self->{"writemakefile"} and ref $self->{"writemakefile"} and $self->{"writemakefile"}->can("failed") and $self->{"writemakefile"}->failed) 0 7 7
if (exists $self->{"writemakefile"} and ref $self->{"writemakefile"} and $self->{"writemakefile"}->can("failed") and $self->{"writemakefile"}->failed) 0 0 0
Condition16%3/18
exists $self->{"writemakefile"} and ref $self->{"writemakefile"} and $self->{"writemakefile"}->can("failed") and $self->{"writemakefile"}->failed
!ll&&!rl&&r
700
exists $self->{"writemakefile"} and ref $self->{"writemakefile"} and $self->{"writemakefile"}->can("failed")
!ll&&!rl&&r
700
exists $self->{"writemakefile"} and ref $self->{"writemakefile"}
!ll&&!rl&&r
700
exists $self->{"writemakefile"} and ref $self->{"writemakefile"} and $self->{"writemakefile"}->can("failed") and $self->{"writemakefile"}->failed
!ll&&!rl&&r
000
exists $self->{"writemakefile"} and ref $self->{"writemakefile"} and $self->{"writemakefile"}->can("failed")
!ll&&!rl&&r
000
exists $self->{"writemakefile"} and ref $self->{"writemakefile"}
!ll&&!rl&&r
000
MC/DC0%0/4
exists $self->{"writemakefile"} and ref $self->{"writemakefile"} and $self->{"writemakefile"}->can("failed") and $self->{"writemakefile"}->failed
exists $self->{"writemakefile"} ref $self->{"writemakefile"} $self->{"writemakefile"}->can("failed") $self->{"writemakefile"}->failed
MC/DC0%0/4
exists $self->{"writemakefile"} and ref $self->{"writemakefile"} and $self->{"writemakefile"}->can("failed") and $self->{"writemakefile"}->failed
exists $self->{"writemakefile"} ref $self->{"writemakefile"} $self->{"writemakefile"}->can("failed") $self->{"writemakefile"}->failed
Truth table20%1/5
A and B and C and D
A= exists $self->{"writemakefile"}B= ref $self->{"writemakefile"}C= $self->{"writemakefile"}->can("failed")D= $self->{"writemakefile"}->failed
ABCDresult
0XXX0
10XX0
110X0
11100
11111
Truth table0%0/5
A and B and C and D
A= exists $self->{"writemakefile"}B= ref $self->{"writemakefile"}C= $self->{"writemakefile"}->can("failed")D= $self->{"writemakefile"}->failed
ABCDresult
0XXX0
10XX0
110X0
11100
11111
419 && $self->{writemakefile}->can("failed") &&
420 $self->{writemakefile}->failed) {
421 #
422 0 $self->post_get();
423 0 return;
424 }
425 0 ▶ $packagedir ||= $self->{build_dir};
Condition16%1/6
$packagedir ||= $self->{"build_dir"}
l!l&&r!l&&!r
700
$packagedir ||= $self->{"build_dir"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$packagedir ||= $self->{"build_dir"}
$packagedir $self->{"build_dir"}
MC/DC0%0/2
$packagedir ||= $self->{"build_dir"}
$packagedir $self->{"build_dir"}
Truth table33%1/3
A ||= B
A= $packagedirB= $self->{"build_dir"}
ABresult
1X1
011
000
Truth table0%0/3
A ||= B
A= $packagedirB= $self->{"build_dir"}
ABresult
1X1
011
000
426 0 $self->{build_dir} = $packagedir;
427 }
428  
429 # XXX should this move up to after run_preps_on_packagedir?
430 # Otherwise, failing writemakefile can return without
431 # a $CPAN::Signal check -- xdg, 2012-04-05
432 0 ▶ if ($CPAN::Signal) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Signal) 0 7 7
if ($CPAN::Signal) 0 0 0
433 0 $self->safe_chdir($sub_wd);
434 0 $self->post_get();
435 0 return;
436 }
437 0 ▶ unless ($self->patch){
Branch: 2 branches
BranchTrueFalseTotal
unless ($self->patch) 0 7 7
unless ($self->patch) 0 0 0
438 0 $self->post_get();
439 0 return;
440 }
441 0 $self->store_persistent_state;
442  
443 0 $self->post_get();
444  
445 0 return 1; # success
446 }
447  
448 #-> CPAN::Distribution::get_file_onto_local_disk
449 7 ▶sub get_file_onto_local_disk {
Subroutine get_file_onto_local_disk: called CC=6 SCAR=29.9
Pod undocumented
450 0 ▶ my($self) = @_;
Subroutine get_file_onto_local_disk: not called CC=6 SCAR=29.9
Pod undocumented
451  
452 0 ▶ return if $self->is_dot_dist;
Branch: 2 branches
BranchTrueFalseTotal
if $self->is_dot_dist 0 7 7
if $self->is_dot_dist 0 0 0
453 0 my($local_file);
454 my($local_wanted) =
455 File::Spec->catfile(
456 $CPAN::Config->{keep_source_where},
457 0 "authors",
458 "id",
459 split(/\//,$self->id)
460 );
461  
462 0 ▶ $self->debug("Doing localize") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
463 0 ▶ unless ($local_file =
Branch: 2 branches
BranchTrueFalseTotal
unless ($local_file = "CPAN::FTP"->localize(qq[authors/id/$self->{"ID"}], $local_wanted)) 0 7 7
unless ($local_file = "CPAN::FTP"->localize(qq[authors/id/$self->{"ID"}], $local_wanted)) 0 0 0
464 CPAN::FTP->localize("authors/id/$self->{ID}",
465 $local_wanted)) {
466 0 my $note = "";
467 0 ▶ if ($CPAN::Index::DATE_OF_02) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Index::DATE_OF_02) 0 0 0
if ($CPAN::Index::DATE_OF_02) 0 0 0
468 0 $note = "Note: Current database in memory was generated ".
469 "on $CPAN::Index::DATE_OF_02\n";
470 }
471 0 $CPAN::Frontend->mydie("Giving up on '$local_wanted'\n$note");
472 }
473  
474 0 ▶ $self->debug("local_wanted[$local_wanted]local_file[$local_file]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
475 0 $self->{localfile} = $local_file;
476 }
477  
478  
479 #-> CPAN::Distribution::check_integrity
480 7 ▶sub check_integrity {
Subroutine check_integrity: called CC=3 SCAR=17.0
Pod undocumented
481 0 ▶ my($self) = @_;
Subroutine check_integrity: not called CC=3 SCAR=17.0
Pod undocumented
482  
483 0 ▶ return if $self->is_dot_dist;
Branch: 2 branches
BranchTrueFalseTotal
if $self->is_dot_dist 0 7 7
if $self->is_dot_dist 0 0 0
484 0 ▶ if ($CPAN::META->has_inst("Digest::SHA")) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::META->has_inst('Digest::SHA')) { } 7 0 7
if ($CPAN::META->has_inst('Digest::SHA')) { } 0 0 0
485 0 $self->debug("Digest::SHA is installed, verifying");
486 0 $self->verifyCHECKSUM;
487 } else {
488 0 $self->debug("Digest::SHA is NOT installed");
489 }
490 }
491  
492 #-> CPAN::Distribution::run_preps_on_packagedir
493 7 ▶sub run_preps_on_packagedir {
Subroutine run_preps_on_packagedir: called CC=29 SCAR=59.3
Pod undocumented
494 0 ▶ my($self) = @_;
Subroutine run_preps_on_packagedir: not called CC=29 SCAR=59.3
Pod undocumented
495 0 ▶ return if $self->is_dot_dist;
Branch: 2 branches
BranchTrueFalseTotal
if $self->is_dot_dist 0 7 7
if $self->is_dot_dist 0 0 0
496  
497 0 ▶ $CPAN::META->{cachemgr} ||= CPAN::CacheMgr->new(); # unsafe meta access, ok
Condition16%1/6
$CPAN::META->{"cachemgr"} ||= "CPAN::CacheMgr"->new
l!l&&r!l&&!r
070
$CPAN::META->{"cachemgr"} ||= "CPAN::CacheMgr"->new
l!l&&r!l&&!r
000
MC/DC0%0/2
$CPAN::META->{"cachemgr"} ||= "CPAN::CacheMgr"->new
$CPAN::META->{"cachemgr"} "CPAN::CacheMgr"->new
MC/DC0%0/2
$CPAN::META->{"cachemgr"} ||= "CPAN::CacheMgr"->new
$CPAN::META->{"cachemgr"} "CPAN::CacheMgr"->new
Truth table33%1/3
A ||= B
A= $CPAN::META->{"cachemgr"}B= "CPAN::CacheMgr"->new
ABresult
1X1
011
000
Truth table0%0/3
A ||= B
A= $CPAN::META->{"cachemgr"}B= "CPAN::CacheMgr"->new
ABresult
1X1
011
000
498 0 my $builddir = $CPAN::META->{cachemgr}->dir; # unsafe meta access, ok
499 0 $self->safe_chdir($builddir);
500 0 ▶ $self->debug("Removing tmp-$$") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
501 0 File::Path::rmtree("tmp-$$");
502 0 ▶ unless (mkdir "tmp-$$", 0755) {
Branch: 2 branches
BranchTrueFalseTotal
unless (mkdir "tmp-${$}", 493) 0 7 7
unless (mkdir "tmp-${$}", 493) 0 0 0
503 0 $CPAN::Frontend->unrecoverable_error(<<EOF);
504 Couldn't mkdir '$builddir/tmp-$$': $!
505  
506 Cannot continue: Please find the reason why I cannot make the
507 directory
508 $builddir/tmp-$$
509 and fix the problem, then retry.
510  
511 EOF
512 }
513 0 ▶ if ($CPAN::Signal) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Signal) 0 7 7
if ($CPAN::Signal) 0 0 0
514 0 return;
515 }
516 0 $self->safe_chdir("tmp-$$");
517  
518 #
519 # Unpack the goods
520 #
521 0 my $local_file = $self->{localfile};
522 0 my $ct = eval{CPAN::Tarzip->new($local_file)};
523 0 ▶ unless ($ct) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($ct) 0 7 7
unless ($ct) 0 0 0
524 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO");
525 0 delete $self->{build_dir};
526 0 return;
527 }
528 0 ▶ if ($local_file =~ /(\.tar\.(bz2|gz|Z)|\.tgz)(?!\n)\Z/i) {
Branch: 4 branches
BranchTrueFalseTotal
if ($local_file =~ /(\.tar\.(bz2|gz|Z)|\.tgz)(?!\n)\Z/i) { } 7 0 7
elsif ($local_file =~ /\.zip(?!\n)\Z/i) { } 0 0 0
if ($local_file =~ /(\.tar\.(bz2|gz|Z)|\.tgz)(?!\n)\Z/i) { } 0 0 0
elsif ($local_file =~ /\.zip(?!\n)\Z/i) { } 0 0 0
529 0 ▶ $self->{was_uncompressed}++ unless eval{$ct->gtest()};
Branch: 2 branches
BranchTrueFalseTotal
unless eval { do { $ct->gtest } } 0 7 7
unless eval { do { $ct->gtest } } 0 0 0
530 0 $self->untar_me($ct);
531 } elsif ( $local_file =~ /\.zip(?!\n)\Z/i ) {
532 0 $self->unzip_me($ct);
533 } else {
534 0 ▶ $self->{was_uncompressed}++ unless $ct->gtest();
Branch: 2 branches
BranchTrueFalseTotal
unless $ct->gtest 0 0 0
unless $ct->gtest 0 0 0
535 0 $local_file = $self->handle_singlefile($local_file);
536 }
537  
538 # we are still in the tmp directory!
539 # Let's check if the package has its own directory.
540 0 ▶ my $dh = DirHandle->new(File::Spec->curdir)
Branch: 2 branches
BranchTrueFalseTotal
my $dh = "DirHandle"->new("File::Spec"->curdir) or Carp::croak("Couldn't opendir .: $!") 7 0 7
my $dh = "DirHandle"->new("File::Spec"->curdir) or Carp::croak("Couldn't opendir .: $!") 0 0 0
541 or Carp::croak("Couldn't opendir .: $!");
542 0 my @readdir = grep $_ !~ /^\.\.?(?!\n)\Z/s, $dh->read; ### MAC??
543 0 ▶ if (grep { $_ eq "pax_global_header" } @readdir) {
Branch: 2 branches
BranchTrueFalseTotal
if (grep {$_ eq "pax_global_header";} @readdir) 0 7 7
if (grep {$_ eq "pax_global_header";} @readdir) 0 0 0
544 0 $CPAN::Frontend->mywarn("Your (un)tar seems to have extracted a file named 'pax_global_header'
545 from the tarball '$local_file'.
546 This is almost certainly an error. Please upgrade your tar.
547 I'll ignore this file for now.
548 See also http://rt.cpan.org/Ticket/Display.html?id=38932\n");
549 0 $CPAN::Frontend->mysleep(5);
550 0 @readdir = grep { $_ ne "pax_global_header" } @readdir;
551 }
552 0 $dh->close;
553 0 my $tdir_base;
554 my $from_dir;
555 0 my @dirents;
556 0 ▶ if (@readdir == 1 && -d $readdir[0]) {
Branch: 2 branches
BranchTrueFalseTotal
if (@readdir == 1 and -d $readdir[0]) { } 7 0 7
if (@readdir == 1 and -d $readdir[0]) { } 0 0 0
Condition16%1/6
@readdir == 1 and -d $readdir[0]
!ll&&!rl&&r
007
@readdir == 1 and -d $readdir[0]
!ll&&!rl&&r
000
MC/DC0%0/2
@readdir == 1 and -d $readdir[0]
@readdir == 1 -d $readdir[0]
MC/DC0%0/2
@readdir == 1 and -d $readdir[0]
@readdir == 1 -d $readdir[0]
Truth table33%1/3
A and B
A= @readdir == 1B= -d $readdir[0]
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= @readdir == 1B= -d $readdir[0]
ABresult
0X0
100
111
557 0 $tdir_base = $readdir[0];
558 0 $from_dir = File::Spec->catdir(File::Spec->curdir,$readdir[0]);
559 0 my($mode) = (stat $from_dir)[2];
560 0 chmod $mode | 00755, $from_dir; # JONATHAN/Math-Calculus-TaylorSeries-0.1.tar.gz has 0644
561 0 my $dh2;
562 0 ▶ unless ($dh2 = DirHandle->new($from_dir)) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($dh2 = "DirHandle"->new($from_dir)) 0 7 7
unless ($dh2 = "DirHandle"->new($from_dir)) 0 0 0
563 0 my $why = sprintf
564 (
565 "Couldn't opendir '%s', mode '%o': %s",
566 $from_dir,
567 $mode,
568 $!,
569 );
570 0 $CPAN::Frontend->mywarn("$why\n");
571 0 $self->{writemakefile} = CPAN::Distrostatus->new("NO -- $why");
572 0 return;
573 }
574 0 @dirents = grep $_ !~ /^\.\.?(?!\n)\Z/s, $dh2->read; ### MAC??
575 } else {
576 0 my $userid = $self->cpan_userid;
577 0 CPAN->debug("userid[$userid]");
578 0 ▶ if (!$userid or $userid eq "N/A") {
Branch: 2 branches
BranchTrueFalseTotal
if (not $userid or $userid eq "N/A") 0 0 0
if (not $userid or $userid eq "N/A") 0 0 0
Condition0%0/6
not $userid or $userid eq "N/A"
l!l&&r!l&&!r
000
not $userid or $userid eq "N/A"
l!l&&r!l&&!r
000
MC/DC0%0/2
not $userid or $userid eq "N/A"
not $userid $userid eq "N/A"
MC/DC0%0/2
not $userid or $userid eq "N/A"
not $userid $userid eq "N/A"
Truth table0%0/3
not(A) or B
A= not $useridB= $userid eq "N/A"
ABresult
1X1
011
000
Truth table0%0/3
not(A) or B
A= not $useridB= $userid eq "N/A"
ABresult
1X1
011
000
579 0 $userid = "anon";
580 }
581 0 $tdir_base = $userid;
582 0 $from_dir = File::Spec->curdir;
583 0 @dirents = @readdir;
584 }
585 0 my $packagedir;
586 0 ▶ my $eexist = ($CPAN::META->has_usable("Errno") && defined &Errno::EEXIST)
Branch: 2 branches
BranchTrueFalseTotal
$CPAN::META->has_usable('Errno') && defined &Errno::EEXIST ? : 7 0 7
$CPAN::META->has_usable('Errno') && defined &Errno::EEXIST ? : 0 0 0
Condition16%1/6
$CPAN::META->has_usable("Errno") and defined &Errno::EEXIST
!ll&&!rl&&r
007
$CPAN::META->has_usable("Errno") and defined &Errno::EEXIST
!ll&&!rl&&r
000
MC/DC0%0/2
$CPAN::META->has_usable("Errno") and defined &Errno::EEXIST
$CPAN::META->has_usable("Errno") defined &Errno::EEXIST
MC/DC0%0/2
$CPAN::META->has_usable("Errno") and defined &Errno::EEXIST
$CPAN::META->has_usable("Errno") defined &Errno::EEXIST
Truth table33%1/3
A and B
A= $CPAN::META->has_usable("Errno")B= defined &Errno::EEXIST
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $CPAN::META->has_usable("Errno")B= defined &Errno::EEXIST
ABresult
0X0
100
111
587 ? &Errno::EEXIST : undef;
588 0 for(my $suffix = 0; ; $suffix++) {
589 0 $packagedir = File::Spec->catdir($builddir, "$tdir_base-$suffix");
590 0 my $parent = $builddir;
591 0 ▶ mkdir($packagedir, 0777) and last;
Branch: 2 branches
BranchTrueFalseTotal
mkdir $packagedir, 511 and last 7 0 7
mkdir $packagedir, 511 and last 0 0 0
592 0 ▶ if((defined($eexist) && $! != $eexist) || $suffix == 999) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $eexist and $! != $eexist or $suffix == 999) 0 0 0
if (defined $eexist and $! != $eexist or $suffix == 999) 0 0 0
Condition0%0/12
defined $eexist and $! != $eexist or $suffix == 999
l!l&&r!l&&!r
000
defined $eexist and $! != $eexist
!ll&&!rl&&r
000
defined $eexist and $! != $eexist or $suffix == 999
l!l&&r!l&&!r
000
defined $eexist and $! != $eexist
!ll&&!rl&&r
000
MC/DC0%0/3
defined $eexist and $! != $eexist or $suffix == 999
defined $eexist $! != $eexist $suffix == 999
MC/DC0%0/3
defined $eexist and $! != $eexist or $suffix == 999
defined $eexist $! != $eexist $suffix == 999
Truth table0%0/5
A and B or C
A= defined $eexistB= $! != $eexistC= $suffix == 999
ABCresult
11X1
0X11
1011
0X00
1000
Truth table0%0/5
A and B or C
A= defined $eexistB= $! != $eexistC= $suffix == 999
ABCresult
11X1
0X11
1011
0X00
1000
593 0 $CPAN::Frontend->mydie("Cannot create directory $packagedir: $!\n");
594 }
595 }
596 0 my $f;
597 0 for $f (@dirents) { # is already without "." and ".."
598 0 my $from = File::Spec->catfile($from_dir,$f);
599 0 my($mode) = (stat $from)[2];
600 0 ▶ chmod $mode | 00755, $from if -d $from; # OTTO/Pod-Trial-LinkImg-0.005.tgz
Branch: 2 branches
BranchTrueFalseTotal
if -d $from 8 30 38
if -d $from 0 0 0
601 0 my $to = File::Spec->catfile($packagedir,$f);
602 0 ▶ unless (File::Copy::move($from,$to)) {
Branch: 2 branches
BranchTrueFalseTotal
unless (File::Copy::move($from, $to)) 0 38 38
unless (File::Copy::move($from, $to)) 0 0 0
603 0 my $err = $!;
604 0 $from = File::Spec->rel2abs($from);
605 0 ▶ $CPAN::Frontend->mydie(
Branch: 4 branches
BranchTrueFalseTotal
-e $from ? : 0 0 0
-e $to ? : 0 0 0
-e $from ? : 0 0 0
-e $to ? : 0 0 0
606 "Couldn't move $from to $to: $err; #82295? ".
607 "CPAN::VERSION=$CPAN::VERSION; ".
608 "File::Copy::VERSION=$File::Copy::VERSION; ".
609 "$from " . (-e $from ? "exists; " : "does not exist; ").
610 "$to " . (-e $to ? "exists; " : "does not exist; ").
611 "cwd=" . CPAN::anycwd() . ";"
612 );
613 }
614 }
615 0 $self->{build_dir} = $packagedir;
616 0 $self->safe_chdir($builddir);
617 0 File::Path::rmtree("tmp-$$");
618  
619 0 $self->safe_chdir($packagedir);
620 0 $self->_signature_business();
621 0 $self->safe_chdir($builddir);
622  
623 0 return($packagedir,$local_file);
624 }
625  
626 #-> sub CPAN::Distribution::pick_meta_file ;
627 62 ▶sub pick_meta_file {
Subroutine pick_meta_file: called CC=11 SCAR=37.7
Pod undocumented
628 0 ▶ my($self, $filter) = @_;
Subroutine pick_meta_file: not called CC=11 SCAR=37.7
Pod undocumented
629 0 ▶ $filter = '.' unless defined $filter;
Branch: 2 branches
BranchTrueFalseTotal
unless defined $filter 47 15 62
unless defined $filter 0 0 0
630  
631 0 my $build_dir;
632 0 ▶ unless ($build_dir = $self->{build_dir}) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($build_dir = $self->{"build_dir"}) 0 62 62
unless ($build_dir = $self->{"build_dir"}) 0 0 0
633 # maybe permission on build_dir was missing
634 0 $CPAN::Frontend->mywarn("Warning: cannot determine META.yml without a build_dir.\n");
635 0 return;
636 }
637  
638 0 my $has_cm = $CPAN::META->has_usable("CPAN::Meta");
639 0 my $has_pcm = $CPAN::META->has_usable("Parse::CPAN::Meta");
640  
641 0 my @choices;
642 0 ▶ push @choices, 'MYMETA.json' if $has_cm;
Branch: 2 branches
BranchTrueFalseTotal
if $has_cm 62 0 62
if $has_cm 0 0 0
643 0 ▶ push @choices, 'MYMETA.yml' if $has_cm || $has_pcm;
Branch: 2 branches
BranchTrueFalseTotal
if $has_cm or $has_pcm 62 0 62
if $has_cm or $has_pcm 0 0 0
Condition16%1/6
$has_cm or $has_pcm
l!l&&r!l&&!r
6200
$has_cm or $has_pcm
l!l&&r!l&&!r
000
MC/DC0%0/2
$has_cm or $has_pcm
$has_cm $has_pcm
MC/DC0%0/2
$has_cm or $has_pcm
$has_cm $has_pcm
Truth table33%1/3
A or B
A= $has_cmB= $has_pcm
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= $has_cmB= $has_pcm
ABresult
1X1
011
000
644 0 ▶ push @choices, 'META.json' if $has_cm;
Branch: 2 branches
BranchTrueFalseTotal
if $has_cm 62 0 62
if $has_cm 0 0 0
645 0 ▶ push @choices, 'META.yml' if $has_cm || $has_pcm;
Branch: 2 branches
BranchTrueFalseTotal
if $has_cm or $has_pcm 62 0 62
if $has_cm or $has_pcm 0 0 0
Condition16%1/6
$has_cm or $has_pcm
l!l&&r!l&&!r
6200
$has_cm or $has_pcm
l!l&&r!l&&!r
000
MC/DC0%0/2
$has_cm or $has_pcm
$has_cm $has_pcm
MC/DC0%0/2
$has_cm or $has_pcm
$has_cm $has_pcm
Truth table33%1/3
A or B
A= $has_cmB= $has_pcm
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= $has_cmB= $has_pcm
ABresult
1X1
011
000
646  
647 0 for my $file ( grep { /$filter/ } @choices ) {
648 0 my $path = File::Spec->catfile( $build_dir, $file );
649 0 ▶ return $path if -f $path
Branch: 2 branches
BranchTrueFalseTotal
if -f $path 50 85 135
if -f $path 0 0 0
650 }
651  
652 0 return;
653 }
654  
655 #-> sub CPAN::Distribution::parse_meta_yml ;
656 17 ▶sub parse_meta_yml {
Subroutine parse_meta_yml: called CC=17 SCAR=47.9
Pod undocumented
657 0 ▶ my($self, $yaml) = @_;
Subroutine parse_meta_yml: not called CC=17 SCAR=47.9
Pod undocumented
658 0 ▶ $self->debug(sprintf("parse_meta_yml[%s]",$yaml||'undef')) if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 17 17
if $CPAN::DEBUG 0 0 0
Condition0%0/4
$yaml || 'undef'
l!l
00
$yaml || 'undef'
l!l
00
MC/DC0%0/1
$yaml || 'undef'
$yaml
MC/DC0%0/1
$yaml || 'undef'
$yaml
Truth table0%0/2
A
A= $yaml
Aresult
11
00
Truth table0%0/2
A
A= $yaml
Aresult
11
00
659 0 ▶ my $build_dir = $self->{build_dir} or die "PANIC: cannot parse yaml without a build_dir";
Branch: 2 branches
BranchTrueFalseTotal
my $build_dir = $self->{"build_dir"} or die "PANIC: cannot parse yaml without a build_dir" 17 0 17
my $build_dir = $self->{"build_dir"} or die "PANIC: cannot parse yaml without a build_dir" 0 0 0
660 0 ▶ $yaml ||= File::Spec->catfile($build_dir,"META.yml");
Condition33%2/6
$yaml ||= "File::Spec"->catfile($build_dir, "META.yml")
l!l&&r!l&&!r
6110
$yaml ||= "File::Spec"->catfile($build_dir, "META.yml")
l!l&&r!l&&!r
000
MC/DC0%0/2
$yaml ||= "File::Spec"->catfile($build_dir, "META.yml")
$yaml "File::Spec"->catfile($build_dir, "META.yml")
MC/DC0%0/2
$yaml ||= "File::Spec"->catfile($build_dir, "META.yml")
$yaml "File::Spec"->catfile($build_dir, "META.yml")
Truth table66%2/3
A ||= B
A= $yamlB= "File::Spec"->catfile($build_dir, "META.yml")
ABresult
1X1
011
000
Truth table0%0/3
A ||= B
A= $yamlB= "File::Spec"->catfile($build_dir, "META.yml")
ABresult
1X1
011
000
661 0 ▶ $self->debug("meta[$yaml]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 17 17
if $CPAN::DEBUG 0 0 0
662 0 ▶ return unless -f $yaml;
Branch: 2 branches
BranchTrueFalseTotal
unless -f $yaml 11 6 17
unless -f $yaml 0 0 0
663 0 my $early_yaml;
664 0 eval {
665 0 ▶ $CPAN::META->has_inst("Parse::CPAN::Meta") or die;
Branch: 2 branches
BranchTrueFalseTotal
$CPAN::META->has_inst("Parse::CPAN::Meta") or die 6 0 6
$CPAN::META->has_inst("Parse::CPAN::Meta") or die 0 0 0
666 0 ▶ die "Parse::CPAN::Meta yaml too old" unless $Parse::CPAN::Meta::VERSION >= "1.40";
Branch: 2 branches
BranchTrueFalseTotal
unless $Parse::CPAN::Meta::VERSION >= "1.40" 0 6 6
unless $Parse::CPAN::Meta::VERSION >= "1.40" 0 0 0
667 # P::C::M returns last document in scalar context
668 0 $early_yaml = Parse::CPAN::Meta::LoadFile($yaml);
669 };
670 0 ▶ unless ($early_yaml) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($early_yaml) 0 6 6
unless ($early_yaml) 0 0 0
671 0 eval { $early_yaml = CPAN->_yaml_loadfile($yaml)->[0]; };
672 }
673 0 ▶ $self->debug(sprintf("yaml[%s]", $early_yaml || 'UNDEF')) if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 6 6
if $CPAN::DEBUG 0 0 0
Condition0%0/4
$early_yaml || 'UNDEF'
l!l
00
$early_yaml || 'UNDEF'
l!l
00
MC/DC0%0/1
$early_yaml || 'UNDEF'
$early_yaml
MC/DC0%0/1
$early_yaml || 'UNDEF'
$early_yaml
Truth table0%0/2
A
A= $early_yaml
Aresult
11
00
Truth table0%0/2
A
A= $early_yaml
Aresult
11
00
674 0 ▶ $self->debug($early_yaml) if $CPAN::DEBUG && $early_yaml;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG and $early_yaml 0 6 6
if $CPAN::DEBUG and $early_yaml 0 0 0
Condition16%1/6
$CPAN::DEBUG and $early_yaml
!ll&&!rl&&r
600
$CPAN::DEBUG and $early_yaml
!ll&&!rl&&r
000
MC/DC0%0/2
$CPAN::DEBUG and $early_yaml
$CPAN::DEBUG $early_yaml
MC/DC0%0/2
$CPAN::DEBUG and $early_yaml
$CPAN::DEBUG $early_yaml
Truth table33%1/3
A and B
A= $CPAN::DEBUGB= $early_yaml
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $CPAN::DEBUGB= $early_yaml
ABresult
0X0
100
111
675 0 ▶ if (!ref $early_yaml or ref $early_yaml ne "HASH"){
Branch: 2 branches
BranchTrueFalseTotal
if (not ref $early_yaml or ref $early_yaml ne "HASH") 0 6 6
if (not ref $early_yaml or ref $early_yaml ne "HASH") 0 0 0
Condition16%1/6
not ref $early_yaml or ref $early_yaml ne "HASH"
l!l&&r!l&&!r
006
not ref $early_yaml or ref $early_yaml ne "HASH"
l!l&&r!l&&!r
000
MC/DC0%0/2
not ref $early_yaml or ref $early_yaml ne "HASH"
not ref $early_yaml ref $early_yaml ne "HASH"
MC/DC0%0/2
not ref $early_yaml or ref $early_yaml ne "HASH"
not ref $early_yaml ref $early_yaml ne "HASH"
Truth table33%1/3
not(A) or B
A= not ref $early_yamlB= ref $early_yaml ne "HASH"
ABresult
1X1
011
000
Truth table0%0/3
not(A) or B
A= not ref $early_yamlB= ref $early_yaml ne "HASH"
ABresult
1X1
011
000
676 # fix rt.cpan.org #95271
677 0 $CPAN::Frontend->mywarn("The content of '$yaml' is not a HASH reference. Cannot use it.\n");
678 0 return {};
679 }
680 0 ▶ return $early_yaml || undef;
Condition25%1/4
$early_yaml || undef
l!l
60
$early_yaml || undef
l!l
00
MC/DC0%0/1
$early_yaml || undef
$early_yaml
MC/DC0%0/1
$early_yaml || undef
$early_yaml
Truth table50%1/2
A
A= $early_yaml
Aresult
11
00
Truth table0%0/2
A
A= $early_yaml
Aresult
11
00
681 }
682  
683 #-> sub CPAN::Distribution::satisfy_requires ;
684 # return values: 1 means requirements are satisfied;
685 # and 0 means not satisfied (and maybe queued)
686 4 ▶sub satisfy_requires {
Subroutine satisfy_requires: called CC=9 SCAR=42.9
Pod undocumented
687 0 ▶ my ($self) = @_;
Subroutine satisfy_requires: not called CC=9 SCAR=42.9
Pod undocumented
688 0 ▶ $self->debug("Entering satisfy_requires") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 4 4
if $CPAN::DEBUG 0 0 0
689 0 ▶ if (my @prereq = $self->unsat_prereq("later")) {
Branch: 2 branches
BranchTrueFalseTotal
if (my(@prereq) = $self->unsat_prereq("later")) 0 4 4
if (my(@prereq) = $self->unsat_prereq("later")) 0 0 0
690 0 ▶ if ($CPAN::DEBUG){
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::DEBUG) 0 0 0
if ($CPAN::DEBUG) 0 0 0
691 0 require Data::Dumper;
692 0 my $prereq = Data::Dumper->new(\@prereq)->Terse(1)->Indent(0)->Dump;
693 0 $self->debug("unsatisfied[$prereq]");
694 }
695 0 ▶ if ($prereq[0][0] eq "perl") {
Branch: 2 branches
BranchTrueFalseTotal
if ($prereq[0][0] eq 'perl') { } 0 0 0
if ($prereq[0][0] eq 'perl') { } 0 0 0
696 0 my $need = "requires perl '$prereq[0][1]'";
697 0 my $id = $self->pretty_id;
698 0 $CPAN::Frontend->mywarn("$id $need; you have only $]; giving up\n");
699 0 $self->{make} = CPAN::Distrostatus->new("NO $need");
700 0 $self->store_persistent_state;
701 0 die "[prereq] -- NOT OK\n";
702 } else {
703 0 my $follow = eval { $self->follow_prereqs("later",@prereq); };
704 0 ▶ if (0) {
Branch: 4 branches
BranchTrueFalseTotal
if (do { $follow }) { } 0 0 0
elsif ($@ and ref $@ and $@->isa('CPAN::Exception::RecursiveDependency')) { } 0 0 0
if (do { $follow }) { } 0 0 0
elsif ($@ and ref $@ and $@->isa('CPAN::Exception::RecursiveDependency')) { } 0 0 0
705 } elsif ($follow) {
706 0 return; # we need deps
707 ▶ } elsif ($@ && ref $@ && $@->isa("CPAN::Exception::RecursiveDependency")) {
Condition0%0/12
$@ and ref $@ and $@->isa("CPAN::Exception::RecursiveDependency")
!ll&&!rl&&r
000
$@ and ref $@
!ll&&!rl&&r
000
$@ and ref $@ and $@->isa("CPAN::Exception::RecursiveDependency")
!ll&&!rl&&r
000
$@ and ref $@
!ll&&!rl&&r
000
MC/DC0%0/3
$@ and ref $@ and $@->isa("CPAN::Exception::RecursiveDependency")
$@ ref $@ $@->isa("CPAN::Exception::RecursiveDependency")
MC/DC0%0/3
$@ and ref $@ and $@->isa("CPAN::Exception::RecursiveDependency")
$@ ref $@ $@->isa("CPAN::Exception::RecursiveDependency")
Truth table0%0/4
A and B and C
A= $@B= ref $@C= $@->isa("CPAN::Exception::RecursiveDependency")
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and B and C
A= $@B= ref $@C= $@->isa("CPAN::Exception::RecursiveDependency")
ABCresult
0XX0
10X0
1100
1111
708 0 $CPAN::Frontend->mywarn($@);
709 0 die "[depend] -- NOT OK\n";
710 }
711 }
712 }
713 0 return 1;
714 }
715  
716 #-> sub CPAN::Distribution::satisfy_configure_requires ;
717 # return values: 1 means configure_require is satisfied;
718 # and 0 means not satisfied (and maybe queued)
719 7 ▶sub satisfy_configure_requires {
Subroutine satisfy_configure_requires: called CC=18 SCAR=56.0
Pod undocumented
720 0 ▶ my($self) = @_;
Subroutine satisfy_configure_requires: not called CC=18 SCAR=56.0
Pod undocumented
721 0 ▶ $self->debug("Entering satisfy_configure_requires") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
722 0 my $enable_configure_requires = 1;
723 0 ▶ if (!$enable_configure_requires) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($enable_configure_requires) 0 7 7
unless ($enable_configure_requires) 0 0 0
724 0 return 1;
725 # if we return 1 here, everything is as before we introduced
726 # configure_requires that means, things with
727 # configure_requires simply fail, all others succeed
728 }
729 0 my @prereq = $self->unsat_prereq("configure_requires_later");
730 0 ▶ $self->debug(sprintf "configure_requires[%s]", join(",",map {join "/",@$_} @prereq)) if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
731 0 ▶ return 1 unless @prereq;
Branch: 2 branches
BranchTrueFalseTotal
unless @prereq 7 0 7
unless @prereq 0 0 0
732 0 ▶ $self->debug(\@prereq) if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
733 0 ▶ if ($self->{configure_requires_later}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{"configure_requires_later"}) 0 0 0
if ($self->{"configure_requires_later"}) 0 0 0
734 0 ▶ for my $k (sort keys %{$self->{configure_requires_later_for}||{}}) {
Condition0%0/4
$self->{'configure_requires_later_for'} || {}
l!l
00
$self->{'configure_requires_later_for'} || {}
l!l
00
MC/DC0%0/1
$self->{'configure_requires_later_for'} || {}
$self->{'configure_requires_later_for'}
MC/DC0%0/1
$self->{'configure_requires_later_for'} || {}
$self->{'configure_requires_later_for'}
Truth table0%0/2
A
A= $self->{'configure_requires_later_for'}
Aresult
11
00
Truth table0%0/2
A
A= $self->{'configure_requires_later_for'}
Aresult
11
00
735 0 ▶ if ($self->{configure_requires_later_for}{$k}>1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{"configure_requires_later_for"}{$k} > 1) 0 0 0
if ($self->{"configure_requires_later_for"}{$k} > 1) 0 0 0
736 0 my $type = "";
737 0 for my $p (@prereq) {
738 0 ▶ if ($p->[0] eq $k) {
Branch: 2 branches
BranchTrueFalseTotal
if ($p->[0] eq $k) 0 0 0
if ($p->[0] eq $k) 0 0 0
739 0 $type = $p->[1];
740 }
741 }
742 0 ▶ $type = " $type" if $type;
Branch: 2 branches
BranchTrueFalseTotal
if $type 0 0 0
if $type 0 0 0
743 0 $CPAN::Frontend->mywarn("Warning: unmanageable(?) prerequisite $k$type");
744 0 sleep 1;
745 }
746 }
747 }
748 0 ▶ if ($prereq[0][0] eq "perl") {
Branch: 2 branches
BranchTrueFalseTotal
if ($prereq[0][0] eq 'perl') { } 0 0 0
if ($prereq[0][0] eq 'perl') { } 0 0 0
749 0 my $need = "requires perl '$prereq[0][1]'";
750 0 my $id = $self->pretty_id;
751 0 $CPAN::Frontend->mywarn("$id $need; you have only $]; giving up\n");
752 0 $self->{make} = CPAN::Distrostatus->new("NO $need");
753 0 $self->store_persistent_state;
754 0 return $self->goodbye("[prereq] -- NOT OK");
755 } else {
756 0 my $follow = eval {
757 0 $self->follow_prereqs("configure_requires_later", @prereq);
758 };
759 0 ▶ if (0) {
Branch: 4 branches
BranchTrueFalseTotal
if (do { $follow }) { } 0 0 0
elsif ($@ and ref $@ and $@->isa('CPAN::Exception::RecursiveDependency')) { } 0 0 0
if (do { $follow }) { } 0 0 0
elsif ($@ and ref $@ and $@->isa('CPAN::Exception::RecursiveDependency')) { } 0 0 0
760 } elsif ($follow) {
761 0 return; # we need deps
762 ▶ } elsif ($@ && ref $@ && $@->isa("CPAN::Exception::RecursiveDependency")) {
Condition0%0/12
$@ and ref $@ and $@->isa("CPAN::Exception::RecursiveDependency")
!ll&&!rl&&r
000
$@ and ref $@
!ll&&!rl&&r
000
$@ and ref $@ and $@->isa("CPAN::Exception::RecursiveDependency")
!ll&&!rl&&r
000
$@ and ref $@
!ll&&!rl&&r
000
MC/DC0%0/3
$@ and ref $@ and $@->isa("CPAN::Exception::RecursiveDependency")
$@ ref $@ $@->isa("CPAN::Exception::RecursiveDependency")
MC/DC0%0/3
$@ and ref $@ and $@->isa("CPAN::Exception::RecursiveDependency")
$@ ref $@ $@->isa("CPAN::Exception::RecursiveDependency")
Truth table0%0/4
A and B and C
A= $@B= ref $@C= $@->isa("CPAN::Exception::RecursiveDependency")
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and B and C
A= $@B= ref $@C= $@->isa("CPAN::Exception::RecursiveDependency")
ABCresult
0XX0
10X0
1100
1111
763 0 $CPAN::Frontend->mywarn($@);
764 0 return $self->goodbye("[depend] -- NOT OK");
765 }
766 else {
767 0 return $self->goodbye("[configure_requires] -- NOT OK");
768 }
769 }
770 0 die "never reached";
771 }
772  
773 #-> sub CPAN::Distribution::choose_MM_or_MB ;
774 7 ▶sub choose_MM_or_MB {
Subroutine choose_MM_or_MB: called CC=15 SCAR=49.2
Pod undocumented
775 0 ▶ my($self) = @_;
Subroutine choose_MM_or_MB: not called CC=15 SCAR=49.2
Pod undocumented
776 0 ▶ $self->satisfy_configure_requires() or return;
Branch: 2 branches
BranchTrueFalseTotal
$self->satisfy_configure_requires or return 7 0 7
$self->satisfy_configure_requires or return 0 0 0
777 0 my $local_file = $self->{localfile};
778 0 my($mpl) = File::Spec->catfile($self->{build_dir},"Makefile.PL");
779 0 my($mpl_exists) = -f $mpl;
780 0 ▶ unless ($mpl_exists) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($mpl_exists) 0 7 7
unless ($mpl_exists) 0 0 0
781 # NFS has been reported to have racing problems after the
782 # renaming of a directory in some environments.
783 # This trick helps.
784 0 $CPAN::Frontend->mysleep(1);
785 my $mpldh = DirHandle->new($self->{build_dir})
786 0 ▶ or Carp::croak("Couldn't opendir $self->{build_dir}: $!");
Branch: 2 branches
BranchTrueFalseTotal
my $mpldh = "DirHandle"->new($self->{"build_dir"}) or Carp::croak(qq[Couldn't opendir $self->{"build_dir"}: $!]) 0 0 0
my $mpldh = "DirHandle"->new($self->{"build_dir"}) or Carp::croak(qq[Couldn't opendir $self->{"build_dir"}: $!]) 0 0 0
787 0 $mpl_exists = grep /^Makefile\.PL$/, $mpldh->read;
788 0 $mpldh->close;
789 }
790 0 my $prefer_installer = "eumm"; # eumm|mb
791 0 ▶ if (-f File::Spec->catfile($self->{build_dir},"Build.PL")) {
Branch: 2 branches
BranchTrueFalseTotal
if (-f "File::Spec"->catfile($self->{"build_dir"}, "Build.PL")) 0 7 7
if (-f "File::Spec"->catfile($self->{"build_dir"}, "Build.PL")) 0 0 0
792 0 ▶ if ($mpl_exists) { # they *can* choose
Branch: 2 branches
BranchTrueFalseTotal
if ($mpl_exists) { } 0 0 0
if ($mpl_exists) { } 0 0 0
793 0 ▶ if ($CPAN::META->has_inst("Module::Build")) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::META->has_inst("Module::Build")) 0 0 0
if ($CPAN::META->has_inst("Module::Build")) 0 0 0
794 0 $prefer_installer = CPAN::HandleConfig->prefs_lookup(
795 $self, q{prefer_installer}
796 );
797 # M::B <= 0.35 left a DATA handle open that
798 # causes problems upgrading M::B on Windows
799 0 ▶ close *Module::Build::Version::DATA
Branch: 2 branches
BranchTrueFalseTotal
if fileno Module::Build::Version::DATA 0 0 0
if fileno Module::Build::Version::DATA 0 0 0
800 if fileno *Module::Build::Version::DATA;
801 }
802 } else {
803 0 $prefer_installer = "mb";
804 }
805 }
806 0 ▶ if (lc($prefer_installer) eq "rand") {
Branch: 2 branches
BranchTrueFalseTotal
if (lc $prefer_installer eq "rand") 0 7 7
if (lc $prefer_installer eq "rand") 0 0 0
807 0 ▶ $prefer_installer = rand()<.5 ? "eumm" : "mb";
Branch: 2 branches
BranchTrueFalseTotal
rand() < 0.5 ? : 0 0 0
rand() < 0.5 ? : 0 0 0
808 }
809 0 ▶ if (lc($prefer_installer) eq "mb") {
Branch: 6 branches
BranchTrueFalseTotal
if (lc $prefer_installer eq 'mb') { } 0 7 7
elsif ($self->{'archived'} eq 'patch') { } 0 7 7
elsif (not $mpl_exists) { } 0 7 7
if (lc $prefer_installer eq 'mb') { } 0 0 0
elsif ($self->{'archived'} eq 'patch') { } 0 0 0
elsif (not $mpl_exists) { } 0 0 0
810 0 $self->{modulebuild} = 1;
811 } elsif ($self->{archived} eq "patch") {
812 # not an edge case, nothing to install for sure
813 0 my $why = "A patch file cannot be installed";
814 0 $CPAN::Frontend->mywarn("Refusing to handle this file: $why\n");
815 0 $self->{writemakefile} = CPAN::Distrostatus->new("NO $why");
816 } elsif (! $mpl_exists) {
817 0 $self->_edge_cases($mpl,$local_file);
818 }
819 0 ▶ if ($self->{build_dir}
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{"build_dir"} and $CPAN::Config->{"build_dir_reuse"}) 0 7 7
if ($self->{"build_dir"} and $CPAN::Config->{"build_dir_reuse"}) 0 0 0
Condition16%1/6
$self->{"build_dir"} and $CPAN::Config->{"build_dir_reuse"}
!ll&&!rl&&r
070
$self->{"build_dir"} and $CPAN::Config->{"build_dir_reuse"}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"build_dir"} and $CPAN::Config->{"build_dir_reuse"}
$self->{"build_dir"} $CPAN::Config->{"build_dir_reuse"}
MC/DC0%0/2
$self->{"build_dir"} and $CPAN::Config->{"build_dir_reuse"}
$self->{"build_dir"} $CPAN::Config->{"build_dir_reuse"}
Truth table33%1/3
A and B
A= $self->{"build_dir"}B= $CPAN::Config->{"build_dir_reuse"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $self->{"build_dir"}B= $CPAN::Config->{"build_dir_reuse"}
ABresult
0X0
100
111
820 &&
821 $CPAN::Config->{build_dir_reuse}
822 ) {
823 0 $self->store_persistent_state;
824 }
825 0 return $self;
826 }
827  
828 # see also reanimate_build_dir
829 #-> CPAN::Distribution::store_persistent_state
830 21 ▶sub store_persistent_state {
Subroutine store_persistent_state: called CC=5 SCAR=26.6
Pod undocumented
831 0 ▶ my($self) = @_;
Subroutine store_persistent_state: not called CC=5 SCAR=26.6
Pod undocumented
832 0 my $dir = $self->{build_dir};
833 0 ▶ unless (defined $dir && length $dir) {
Branch: 2 branches
BranchTrueFalseTotal
unless (defined $dir and length $dir) 0 21 21
unless (defined $dir and length $dir) 0 0 0
Condition16%1/6
defined $dir and length $dir
!ll&&!rl&&r
0021
defined $dir and length $dir
!ll&&!rl&&r
000
MC/DC0%0/2
defined $dir and length $dir
defined $dir length $dir
MC/DC0%0/2
defined $dir and length $dir
defined $dir length $dir
Truth table33%1/3
A and B
A= defined $dirB= length $dir
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $dirB= length $dir
ABresult
0X0
100
111
834 0 my $id = $self->id;
835 0 $CPAN::Frontend->mywarnonce("build_dir of $id is not known, ".
836 "will not store persistent state\n");
837 0 return;
838 }
839 # self-build-dir
840 0 my $sbd = Cwd::realpath(
841 File::Spec->catdir($dir, File::Spec->updir ())
842 );
843 # config-build-dir
844 my $cbd = Cwd::realpath(
845 # the catdir is a workaround for bug https://rt.cpan.org/Ticket/Display.html?id=101283
846 0 File::Spec->catdir($CPAN::Config->{build_dir}, File::Spec->curdir())
847 );
848 0 ▶ unless ($sbd eq $cbd) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($sbd eq $cbd) 0 21 21
unless ($sbd eq $cbd) 0 0 0
849 0 $CPAN::Frontend->mywarnonce("Directory '$dir' not below $CPAN::Config->{build_dir}, ".
850 "will not store persistent state\n");
851 0 return;
852 }
853 0 my $file = sprintf "%s.yml", $dir;
854 0 my $yaml_module = CPAN::_yaml_module();
855 0 ▶ if ($CPAN::META->has_inst($yaml_module)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::META->has_inst($yaml_module)) { } 21 0 21
if ($CPAN::META->has_inst($yaml_module)) { } 0 0 0
856 0 CPAN->_yaml_dumpfile(
857 $file,
858 {
859 time => time,
860 perl => CPAN::_perl_fingerprint(),
861 distribution => $self,
862 }
863 );
864 } else {
865 0 $CPAN::Frontend->myprintonce("'$yaml_module' not installed, ".
866 "will not store persistent state\n");
867 }
868 }
869  
870 #-> CPAN::Distribution::try_download
871 0 ▶sub try_download {
Subroutine try_download: not called CC=2 SCAR=17.9
Pod undocumented
872 0 ▶ my($self,$patch) = @_;
Subroutine try_download: not called CC=2 SCAR=17.9
Pod undocumented
873 0 my $norm = $self->normalize($patch);
874 my($local_wanted) =
875 File::Spec->catfile(
876 $CPAN::Config->{keep_source_where},
877 0 "authors",
878 "id",
879 split(/\//,$norm),
880 );
881 0 ▶ $self->debug("Doing localize") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
882 0 return CPAN::FTP->localize("authors/id/$norm",
883 $local_wanted);
884 }
885  
886 {
887 26 my $stdpatchargs = "";
888 #-> CPAN::Distribution::patch
889 7 ▶ sub patch {
Subroutine patch: called CC=31 SCAR=67.8
Pod undocumented
890 0 ▶ my($self) = @_;
Subroutine patch: not called CC=31 SCAR=67.8
Pod undocumented
891 0 ▶ $self->debug("checking patches id[$self->{ID}]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
892 0 my $patches = $self->prefs->{patches};
893 0 ▶ $patches ||= "";
Condition25%1/4
$patches ||= ""
l!l
07
$patches ||= ""
l!l
00
MC/DC0%0/1
$patches ||= ""
$patches
MC/DC0%0/1
$patches ||= ""
$patches
Truth table50%1/2
A
A= $patches
Aresult
11
00
Truth table0%0/2
A
A= $patches
Aresult
11
00
894 0 ▶ $self->debug("patches[$patches]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
895 0 ▶ if ($patches) {
Branch: 2 branches
BranchTrueFalseTotal
if ($patches) 0 7 7
if ($patches) 0 0 0
896 0 ▶ return unless @$patches;
Branch: 2 branches
BranchTrueFalseTotal
unless @$patches 0 0 0
unless @$patches 0 0 0
897 0 $self->safe_chdir($self->{build_dir});
898 0 ▶ CPAN->debug("patches[$patches]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
899 0 my $patchbin = $CPAN::Config->{patch};
900 0 ▶ unless ($patchbin && length $patchbin) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($patchbin and length $patchbin) 0 0 0
unless ($patchbin and length $patchbin) 0 0 0
Condition0%0/6
$patchbin and length $patchbin
!ll&&!rl&&r
000
$patchbin and length $patchbin
!ll&&!rl&&r
000
MC/DC0%0/2
$patchbin and length $patchbin
$patchbin length $patchbin
MC/DC0%0/2
$patchbin and length $patchbin
$patchbin length $patchbin
Truth table0%0/3
A and B
A= $patchbinB= length $patchbin
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $patchbinB= length $patchbin
ABresult
0X0
100
111
901 0 $CPAN::Frontend->mydie("No external patch command configured\n\n".
902 "Please run 'o conf init /patch/'\n\n");
903 }
904 0 ▶ unless (MM->maybe_command($patchbin)) {
Branch: 2 branches
BranchTrueFalseTotal
unless ("MM"->maybe_command($patchbin)) 0 0 0
unless ("MM"->maybe_command($patchbin)) 0 0 0
905 0 $CPAN::Frontend->mydie("No external patch command available\n\n".
906 "Please run 'o conf init /patch/'\n\n");
907 }
908 0 $patchbin = CPAN::HandleConfig->safe_quote($patchbin);
909 0 local $ENV{PATCH_GET} = 0; # formerly known as -g0
910 0 ▶ unless ($stdpatchargs) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($stdpatchargs) 0 0 0
unless ($stdpatchargs) 0 0 0
911 0 my $system = "$patchbin --version |";
912 0 local *FH;
913 0 ▶ open FH, $system or die "Could not fork '$system': $!";
Branch: 2 branches
BranchTrueFalseTotal
open FH, $system or die "Could not fork '${system}': $!" 0 0 0
open FH, $system or die "Could not fork '${system}': $!" 0 0 0
914 0 local $/ = "\n";
915 0 my $pversion;
916 0 ▶ PARSEVERSION: while (<FH>) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined($_ = readline FH)) 0 0 0
if (defined($_ = readline FH)) 0 0 0
917 0 ▶ if (/^patch\s+([\d\.]+)/) {
Branch: 2 branches
BranchTrueFalseTotal
if (/^patch\s+([\d\.]+)/) 0 0 0
if (/^patch\s+([\d\.]+)/) 0 0 0
918 0 $pversion = $1;
919 0 last PARSEVERSION;
920 }
921 }
922 0 ▶ if ($pversion) {
Branch: 2 branches
BranchTrueFalseTotal
if ($pversion) { } 0 0 0
if ($pversion) { } 0 0 0
923 0 $stdpatchargs = "-N --fuzz=3";
924 } else {
925 0 $stdpatchargs = "-N";
926 }
927 }
928 0 ▶ my $countedpatches = @$patches == 1 ? "1 patch" : (scalar @$patches . " patches");
Branch: 2 branches
BranchTrueFalseTotal
@$patches == 1 ? : 0 0 0
@$patches == 1 ? : 0 0 0
929 0 $CPAN::Frontend->myprint("Applying $countedpatches:\n");
930 0 my $patches_dir = $CPAN::Config->{patches_dir};
931 0 for my $patch (@$patches) {
932 0 ▶ if ($patches_dir && !File::Spec->file_name_is_absolute($patch)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($patches_dir and not "File::Spec"->file_name_is_absolute($patch)) 0 0 0
if ($patches_dir and not "File::Spec"->file_name_is_absolute($patch)) 0 0 0
Condition0%0/6
$patches_dir and not "File::Spec"->file_name_is_absolute($patch)
!ll&&!rl&&r
000
$patches_dir and not "File::Spec"->file_name_is_absolute($patch)
!ll&&!rl&&r
000
MC/DC0%0/2
$patches_dir and not "File::Spec"->file_name_is_absolute($patch)
$patches_dir not "File::Spec"->file_name_is_absolute($patch)
MC/DC0%0/2
$patches_dir and not "File::Spec"->file_name_is_absolute($patch)
$patches_dir not "File::Spec"->file_name_is_absolute($patch)
Truth table0%0/3
A and not(B)
A= $patches_dirB= not "File::Spec"->file_name_is_absolute($patch)
ABresult
0X0
100
111
Truth table0%0/3
A and not(B)
A= $patches_dirB= not "File::Spec"->file_name_is_absolute($patch)
ABresult
0X0
100
111
933 0 my $f = File::Spec->catfile($patches_dir, $patch);
934 0 ▶ $patch = $f if -f $f;
Branch: 2 branches
BranchTrueFalseTotal
if -f $f 0 0 0
if -f $f 0 0 0
935 }
936 0 ▶ unless (-f $patch) {
Branch: 2 branches
BranchTrueFalseTotal
unless (-f $patch) 0 0 0
unless (-f $patch) 0 0 0
937 0 ▶ CPAN->debug("not on disk: patch[$patch]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
938 0 ▶ if (my $trydl = $self->try_download($patch)) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $trydl = $self->try_download($patch)) { } 0 0 0
if (my $trydl = $self->try_download($patch)) { } 0 0 0
939 0 $patch = $trydl;
940 } else {
941 0 my $fail = "Could not find patch '$patch'";
942 0 $CPAN::Frontend->mywarn("$fail; cannot continue\n");
943 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- $fail");
944 0 delete $self->{build_dir};
945 0 return;
946 }
947 }
948 0 $CPAN::Frontend->myprint(" $patch\n");
949 0 my $readfh = CPAN::Tarzip->TIEHANDLE($patch);
950  
951 0 my $pcommand;
952 0 my($ppp,$pfiles) = $self->_patch_p_parameter($readfh);
953 0 ▶ if ($ppp eq "applypatch") {
Branch: 2 branches
BranchTrueFalseTotal
if ($ppp eq 'applypatch') { } 0 0 0
if ($ppp eq 'applypatch') { } 0 0 0
954 0 $pcommand = "$CPAN::Config->{applypatch} -verbose";
955 } else {
956 0 my $thispatchargs = join " ", $stdpatchargs, $ppp;
957 0 $pcommand = "$patchbin $thispatchargs";
958 0 require Config; # usually loaded from CPAN.pm
959 0 ▶ if ($Config::Config{osname} eq "solaris") {
Branch: 2 branches
BranchTrueFalseTotal
if ($Config::Config{"osname"} eq "solaris") 0 0 0
if ($Config::Config{"osname"} eq "solaris") 0 0 0
960 # native solaris patch cannot patch readonly files
961 0 ▶ for my $file (@{$pfiles||[]}) {
Condition0%0/4
$pfiles || []
l!l
00
$pfiles || []
l!l
00
MC/DC0%0/1
$pfiles || []
$pfiles
MC/DC0%0/1
$pfiles || []
$pfiles
Truth table0%0/2
A
A= $pfiles
Aresult
11
00
Truth table0%0/2
A
A= $pfiles
Aresult
11
00
962 0 ▶ my @stat = stat $file or next;
Branch: 2 branches
BranchTrueFalseTotal
my(@stat) = stat $file or next 0 0 0
my(@stat) = stat $file or next 0 0 0
963 0 chmod $stat[2] | 0600, $file; # may fail
964 }
965 }
966 }
967  
968 0 $readfh = CPAN::Tarzip->TIEHANDLE($patch); # open again
969 0 my $writefh = FileHandle->new;
970 0 $CPAN::Frontend->myprint(" $pcommand\n");
971 0 ▶ unless (open $writefh, "|$pcommand") {
Branch: 2 branches
BranchTrueFalseTotal
unless (open $writefh, "|$pcommand") 0 0 0
unless (open $writefh, "|$pcommand") 0 0 0
972 0 my $fail = "Could not fork '$pcommand'";
973 0 $CPAN::Frontend->mywarn("$fail; cannot continue\n");
974 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- $fail");
975 0 delete $self->{build_dir};
976 0 return;
977 }
978 0 binmode($writefh);
979 0 ▶ while (my $x = $readfh->READLINE) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $x = $readfh->READLINE) 0 0 0
if (my $x = $readfh->READLINE) 0 0 0
980 0 print $writefh $x;
981 }
982 0 ▶ unless (close $writefh) {
Branch: 2 branches
BranchTrueFalseTotal
unless (close $writefh) 0 0 0
unless (close $writefh) 0 0 0
983 0 my $fail = "Could not apply patch '$patch'";
984 0 $CPAN::Frontend->mywarn("$fail; cannot continue\n");
985 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- $fail");
986 0 delete $self->{build_dir};
987 0 return;
988 }
989 }
990 0 $self->{patched}++;
991 }
992 0 return 1;
993 }
994 }
995  
996 # may return
997 # - "applypatch"
998 # - ("-p0"|"-p1", $files)
999 26 ▶sub _patch_p_parameter {
Subroutine _patch_p_parameter: not called CC=9 SCAR=44.6
1000 0 ▶ my($self,$fh) = @_;
Subroutine _patch_p_parameter: not called CC=9 SCAR=45.0
1001 0 my $cnt_files = 0;
1002 0 my $cnt_p0files = 0;
1003 0 my @files;
1004 0 local($_);
1005 0 ▶ while ($_ = $fh->READLINE) {
Branch: 2 branches
BranchTrueFalseTotal
if ($_ = $fh->READLINE) 0 0 0
if ($_ = $fh->READLINE) 0 0 0
1006 0 ▶ if (
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Config->{"applypatch"} and /\#\#\#\# ApplyPatch data follows \#\#\#\#/) 0 0 0
if ($CPAN::Config->{"applypatch"} and /\#\#\#\# ApplyPatch data follows \#\#\#\#/) 0 0 0
Condition0%0/6
$CPAN::Config->{"applypatch"} and /\#\#\#\# ApplyPatch data follows \#\#\#\#/
!ll&&!rl&&r
000
$CPAN::Config->{"applypatch"} and /\#\#\#\# ApplyPatch data follows \#\#\#\#/
!ll&&!rl&&r
000
MC/DC0%0/2
$CPAN::Config->{"applypatch"} and /\#\#\#\# ApplyPatch data follows \#\#\#\#/
$CPAN::Config->{"applypatch"} /\#\#\#\# ApplyPatch data follows \#\#\#\#/
MC/DC0%0/2
$CPAN::Config->{"applypatch"} and /\#\#\#\# ApplyPatch data follows \#\#\#\#/
$CPAN::Config->{"applypatch"} /\#\#\#\# ApplyPatch data follows \#\#\#\#/
Truth table0%0/3
A and B
A= $CPAN::Config->{"applypatch"}B= /\#\#\#\# ApplyPatch data follows \#\#\#\#/
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $CPAN::Config->{"applypatch"}B= /\#\#\#\# ApplyPatch data follows \#\#\#\#/
ABresult
0X0
100
111
1007 $CPAN::Config->{applypatch}
1008 &&
1009 /\#\#\#\# ApplyPatch data follows \#\#\#\#/
1010 ) {
1011 0 return "applypatch"
1012 }
1013 0 ▶ next unless /^[\*\+]{3}\s(\S+)/;
Branch: 2 branches
BranchTrueFalseTotal
unless /^[\*\+]{3}\s(\S+)/ 0 0 0
unless /^[\*\+]{3}\s(\S+)/ 0 0 0
1014 0 my $file = $1;
1015 0 push @files, $file;
1016 0 $cnt_files++;
1017 0 ▶ $cnt_p0files++ if -f $file;
Branch: 2 branches
BranchTrueFalseTotal
if -f $file 0 0 0
if -f $file 0 0 0
1018 0 ▶ CPAN->debug("file[$file]cnt_files[$cnt_files]cnt_p0files[$cnt_p0files]")
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
1019 if $CPAN::DEBUG;
1020 }
1021 0 ▶ return "-p1" unless $cnt_files;
Branch: 2 branches
BranchTrueFalseTotal
unless $cnt_files 0 0 0
unless $cnt_files 0 0 0
1022 0 ▶ my $opt_p = $cnt_files==$cnt_p0files ? "-p0" : "-p1";
Branch: 2 branches
BranchTrueFalseTotal
$cnt_files == $cnt_p0files ? : 0 0 0
$cnt_files == $cnt_p0files ? : 0 0 0
1023 0 return ($opt_p, \@files);
1024 }
1025  
1026 #-> sub CPAN::Distribution::_edge_cases
1027 # with "configure" or "Makefile" or single file scripts
1028 0 ▶sub _edge_cases {
Subroutine _edge_cases: not called CC=10 SCAR=47.0
1029 0 ▶ my($self,$mpl,$local_file) = @_;
Subroutine _edge_cases: not called CC=10 SCAR=47.0
1030 0 ▶ $self->debug(sprintf("makefilepl[%s]anycwd[%s]",
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
1031 $mpl,
1032 CPAN::anycwd(),
1033 )) if $CPAN::DEBUG;
1034 0 my $build_dir = $self->{build_dir};
1035 0 my($configure) = File::Spec->catfile($build_dir,"Configure");
1036 0 ▶ if (-f $configure) {
Branch: 4 branches
BranchTrueFalseTotal
if (-f $configure) { } 0 0 0
elsif (-f 'File::Spec'->catfile($build_dir, 'Makefile')) { } 0 0 0
if (-f $configure) { } 0 0 0
elsif (-f 'File::Spec'->catfile($build_dir, 'Makefile')) { } 0 0 0
1037 # do we have anything to do?
1038 0 $self->{configure} = $configure;
1039 } elsif (-f File::Spec->catfile($build_dir,"Makefile")) {
1040 0 $CPAN::Frontend->mywarn(qq{
1041 Package comes with a Makefile and without a Makefile.PL.
1042 We\'ll try to build it with that Makefile then.
1043 });
1044 0 $self->{writemakefile} = CPAN::Distrostatus->new("YES");
1045 0 $CPAN::Frontend->mysleep(2);
1046 } else {
1047 0 ▶ my $cf = $self->called_for || "unknown";
Condition0%0/4
$self->called_for || 'unknown'
l!l
00
$self->called_for || 'unknown'
l!l
00
MC/DC0%0/1
$self->called_for || 'unknown'
$self->called_for
MC/DC0%0/1
$self->called_for || 'unknown'
$self->called_for
Truth table0%0/2
A
A= $self->called_for
Aresult
11
00
Truth table0%0/2
A
A= $self->called_for
Aresult
11
00
1048 0 ▶ if ($cf =~ m|/|) {
Branch: 2 branches
BranchTrueFalseTotal
if ($cf =~ m[/]) 0 0 0
if ($cf =~ m[/]) 0 0 0
1049 0 $cf =~ s|.*/||;
1050 0 $cf =~ s|\W.*||;
1051 }
1052 0 $cf =~ s|[/\\:]||g; # risk of filesystem damage
1053 0 ▶ $cf = "unknown" unless length($cf);
Branch: 2 branches
BranchTrueFalseTotal
unless length $cf 0 0 0
unless length $cf 0 0 0
1054 0 ▶ if (my $crud = $self->_contains_crud($build_dir)) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $crud = $self->_contains_crud($build_dir)) 0 0 0
if (my $crud = $self->_contains_crud($build_dir)) 0 0 0
1055 0 my $why = qq{Package contains $crud; not recognized as a perl package, giving up};
1056 0 $CPAN::Frontend->mywarn("$why\n");
1057 0 $self->{writemakefile} = CPAN::Distrostatus->new(qq{NO -- $why});
1058 0 return;
1059 }
1060 0 $CPAN::Frontend->mywarn(qq{Package seems to come without Makefile.PL.
1061 (The test -f "$mpl" returned false.)
1062 Writing one on our own (setting NAME to $cf)\a\n});
1063 0 $self->{had_no_makefile_pl}++;
1064 0 $CPAN::Frontend->mysleep(3);
1065  
1066 # Writing our own Makefile.PL
1067  
1068 0 my $exefile_stanza = "";
1069 0 ▶ if ($self->{archived} eq "maybe_pl") {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{"archived"} eq "maybe_pl") 0 0 0
if ($self->{"archived"} eq "maybe_pl") 0 0 0
1070 0 $exefile_stanza = $self->_exefile_stanza($build_dir,$local_file);
1071 }
1072  
1073 0 my $fh = FileHandle->new;
1074 0 ▶ $fh->open(">$mpl")
Branch: 2 branches
BranchTrueFalseTotal
$fh->open(">$mpl") or Carp::croak("Could not open >${mpl}: $!") 0 0 0
$fh->open(">$mpl") or Carp::croak("Could not open >${mpl}: $!") 0 0 0
1075 or Carp::croak("Could not open >$mpl: $!");
1076 0 $fh->print(
1077 qq{# This Makefile.PL has been autogenerated by the module CPAN.pm
1078 # because there was no Makefile.PL supplied.
1079 # Autogenerated on: }.scalar localtime().qq{
1080  
1081 use ExtUtils::MakeMaker;
1082 WriteMakefile(
1083 NAME => q[$cf],$exefile_stanza
1084 );
1085 });
1086 0 $fh->close;
1087 }
1088 }
1089  
1090 #-> CPAN;:Distribution::_contains_crud
1091 0 ▶sub _contains_crud {
Subroutine _contains_crud: not called CC=9 SCAR=45.0
1092 0 ▶ my($self,$dir) = @_;
Subroutine _contains_crud: not called CC=9 SCAR=45.0
1093 0 my(@dirs, $dh, @files);
1094 0 ▶ opendir $dh, $dir or return;
Branch: 2 branches
BranchTrueFalseTotal
opendir $dh, $dir or return 0 0 0
opendir $dh, $dir or return 0 0 0
1095 0 my $dirent;
1096 0 for $dirent (readdir $dh) {
1097 0 ▶ next if $dirent =~ /^\.\.?$/;
Branch: 2 branches
BranchTrueFalseTotal
if $dirent =~ /^\.\.?$/ 0 0 0
if $dirent =~ /^\.\.?$/ 0 0 0
1098 0 my $path = File::Spec->catdir($dir,$dirent);
1099 0 ▶ if (-d $path) {
Branch: 4 branches
BranchTrueFalseTotal
if (-d $path) { } 0 0 0
elsif (-f $path) { } 0 0 0
if (-d $path) { } 0 0 0
elsif (-f $path) { } 0 0 0
1100 0 push @dirs, $dirent;
1101 } elsif (-f $path) {
1102 0 push @files, $dirent;
1103 }
1104 }
1105 0 ▶ if (@dirs && @files) {
Branch: 4 branches
BranchTrueFalseTotal
if (@dirs and @files) { } 0 0 0
elsif (@files > 2) { } 0 0 0
if (@dirs and @files) { } 0 0 0
elsif (@files > 2) { } 0 0 0
Condition0%0/6
@dirs and @files
!ll&&!rl&&r
000
@dirs and @files
!ll&&!rl&&r
000
MC/DC0%0/2
@dirs and @files
@dirs @files
MC/DC0%0/2
@dirs and @files
@dirs @files
Truth table0%0/3
A and B
A= @dirsB= @files
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= @dirsB= @files
ABresult
0X0
100
111
1106 0 return "both files[@files] and directories[@dirs]";
1107 } elsif (@files > 2) {
1108 0 return "several files[@files] but no Makefile.PL or Build.PL";
1109 }
1110 0 return;
1111 }
1112  
1113 #-> CPAN;:Distribution::_exefile_stanza
1114 0 ▶sub _exefile_stanza {
Subroutine _exefile_stanza: not called CC=18 SCAR=58.3
1115 0 ▶ my($self,$build_dir,$local_file) = @_;
Subroutine _exefile_stanza: not called CC=18 SCAR=58.3
1116  
1117 0 my $fh = FileHandle->new;
1118 0 my $script_file = File::Spec->catfile($build_dir,$local_file);
1119 0 ▶ $fh->open($script_file)
Branch: 2 branches
BranchTrueFalseTotal
$fh->open($script_file) or Carp::croak("Could not open script '${script_file}': $!") 0 0 0
$fh->open($script_file) or Carp::croak("Could not open script '${script_file}': $!") 0 0 0
1120 or Carp::croak("Could not open script '$script_file': $!");
1121 0 local $/ = "\n";
1122 # parse name and prereq
1123 0 my($state) = "poddir";
1124 0 my($name, $prereq) = ("", "");
1125 0 ▶ while (<$fh>) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
if (defined($_ = readline $fh)) 0 0 0
1126 0 ▶ if ($state eq "poddir" && /^=head\d\s+(\S+)/) {
Branch: 6 branches
BranchTrueFalseTotal
if ($state eq 'poddir' and /^=head\d\s+(\S+)/) { } 0 0 0
elsif ($state =~ /^(name|prereq)$/) { } 0 0 0
elsif (/^=cut\b/) { } 0 0 0
if ($state eq 'poddir' and /^=head\d\s+(\S+)/) { } 0 0 0
elsif ($state =~ /^(name|prereq)$/) { } 0 0 0
elsif (/^=cut\b/) { } 0 0 0
Condition0%0/6
$state eq "poddir" and /^=head\d\s+(\S+)/
!ll&&!rl&&r
000
$state eq "poddir" and /^=head\d\s+(\S+)/
!ll&&!rl&&r
000
MC/DC0%0/2
$state eq "poddir" and /^=head\d\s+(\S+)/
$state eq "poddir" /^=head\d\s+(\S+)/
MC/DC0%0/2
$state eq "poddir" and /^=head\d\s+(\S+)/
$state eq "poddir" /^=head\d\s+(\S+)/
Truth table0%0/3
A and B
A= $state eq "poddir"B= /^=head\d\s+(\S+)/
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $state eq "poddir"B= /^=head\d\s+(\S+)/
ABresult
0X0
100
111
1127 0 ▶ if ($1 eq 'NAME') {
Branch: 4 branches
BranchTrueFalseTotal
if ($1 eq 'NAME') { } 0 0 0
elsif ($1 eq 'PREREQUISITES') { } 0 0 0
if ($1 eq 'NAME') { } 0 0 0
elsif ($1 eq 'PREREQUISITES') { } 0 0 0
1128 0 $state = "name";
1129 } elsif ($1 eq 'PREREQUISITES') {
1130 0 $state = "prereq";
1131 }
1132 } elsif ($state =~ m{^(name|prereq)$}) {
1133 0 ▶ if (/^=/) {
Branch: 8 branches
BranchTrueFalseTotal
if (/^=/) { } 0 0 0
elsif (/^\s*$/) { } 0 0 0
elsif ($state eq 'name') { } 0 0 0
elsif ($state eq 'prereq') { } 0 0 0
if (/^=/) { } 0 0 0
elsif (/^\s*$/) { } 0 0 0
elsif ($state eq 'name') { } 0 0 0
elsif ($state eq 'prereq') { } 0 0 0
1134 0 $state = "poddir";
1135 } elsif (/^\s*$/) {
1136 # nop
1137 } elsif ($state eq "name") {
1138 0 ▶ if ($name eq "") {
Branch: 2 branches
BranchTrueFalseTotal
if ($name eq "") 0 0 0
if ($name eq "") 0 0 0
1139 0 ($name) = /^(\S+)/;
1140 0 $state = "poddir";
1141 }
1142 } elsif ($state eq "prereq") {
1143 0 $prereq .= $_;
1144 }
1145 } elsif (/^=cut\b/) {
1146 0 last;
1147 }
1148 }
1149 0 $fh->close;
1150  
1151 0 for ($name) {
1152 0 s{.*<}{}; # strip X<...>
1153 0 s{>.*}{};
1154 }
1155 0 chomp $prereq;
1156 0 $prereq = join " ", split /\s+/, $prereq;
1157 my($PREREQ_PM) = join("\n", map {
1158 0 s{.*<}{}; # strip X<...>
1159 0 s{>.*}{};
1160 0 ▶ if (/[\s\'\"]/) { # prose?
Branch: 2 branches
BranchTrueFalseTotal
if (/[\s\'\"]/) { } 0 0 0
if (/[\s\'\"]/) { } 0 0 0
1161 } else {
1162 0 s/[^\w:]$//; # period?
1163 0 " "x28 . "'$_' => 0,";
1164 }
1165 } split /\s*,\s*/, $prereq);
1166  
1167 0 ▶ if ($name) {
Branch: 2 branches
BranchTrueFalseTotal
if ($name) 0 0 0
if ($name) 0 0 0
1168 0 my $to_file = File::Spec->catfile($build_dir, $name);
1169 0 ▶ rename $script_file, $to_file
Branch: 2 branches
BranchTrueFalseTotal
rename $script_file, $to_file or die "Can't rename $script_file to ${to_file}: $!" 0 0 0
rename $script_file, $to_file or die "Can't rename $script_file to ${to_file}: $!" 0 0 0
1170 or die "Can't rename $script_file to $to_file: $!";
1171 }
1172  
1173 0 return "
1174 EXE_FILES => ['$name'],
1175 PREREQ_PM => {
1176 $PREREQ_PM
1177 },
1178 ";
1179 }
1180  
1181 #-> CPAN::Distribution::_signature_business
1182 7 ▶sub _signature_business {
Subroutine _signature_business: called CC=10 SCAR=45.5
1183 0 ▶ my($self) = @_;
Subroutine _signature_business: not called CC=10 SCAR=45.5
1184 0 my $check_sigs = CPAN::HandleConfig->prefs_lookup($self,
1185 q{check_sigs});
1186 0 ▶ if ($check_sigs) {
Branch: 2 branches
BranchTrueFalseTotal
if ($check_sigs) 0 7 7
if ($check_sigs) 0 0 0
1187 0 ▶ if ($CPAN::META->has_inst("Module::Signature")) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::META->has_inst('Module::Signature')) { } 0 0 0
if ($CPAN::META->has_inst('Module::Signature')) { } 0 0 0
1188 0 ▶ if (-f "SIGNATURE") {
Branch: 2 branches
BranchTrueFalseTotal
if (-f 'SIGNATURE') { } 0 0 0
if (-f 'SIGNATURE') { } 0 0 0
1189 0 ▶ $self->debug("Module::Signature is installed, verifying") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
1190 0 my $rv = Module::Signature::verify();
1191 0 ▶ if ($rv != Module::Signature::SIGNATURE_OK() and
Branch: 2 branches
BranchTrueFalseTotal
if ($rv != Module::Signature::SIGNATURE_OK() and $rv != Module::Signature::SIGNATURE_MISSING()) { } 0 0 0
if ($rv != Module::Signature::SIGNATURE_OK() and $rv != Module::Signature::SIGNATURE_MISSING()) { } 0 0 0
Condition0%0/6
$rv != Module::Signature::SIGNATURE_OK() and $rv != Module::Signature::SIGNATURE_MISSING()
!ll&&!rl&&r
000
$rv != Module::Signature::SIGNATURE_OK() and $rv != Module::Signature::SIGNATURE_MISSING()
!ll&&!rl&&r
000
MC/DC0%0/2
$rv != Module::Signature::SIGNATURE_OK() and $rv != Module::Signature::SIGNATURE_MISSING()
$rv != Module::Signature::SIGNATURE_OK() $rv != Module::Signature::SIGNATURE_MISSING()
MC/DC0%0/2
$rv != Module::Signature::SIGNATURE_OK() and $rv != Module::Signature::SIGNATURE_MISSING()
$rv != Module::Signature::SIGNATURE_OK() $rv != Module::Signature::SIGNATURE_MISSING()
Truth table0%0/3
A and B
A= $rv != Module::Signature::SIGNATURE_OK()B= $rv != Module::Signature::SIGNATURE_MISSING()
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $rv != Module::Signature::SIGNATURE_OK()B= $rv != Module::Signature::SIGNATURE_MISSING()
ABresult
0X0
100
111
1192 $rv != Module::Signature::SIGNATURE_MISSING()) {
1193 0 $CPAN::Frontend->mywarn(
1194 qq{\nSignature invalid for }.
1195 qq{distribution file. }.
1196 qq{Please investigate.\n\n}
1197 );
1198  
1199 my $wrap =
1200 sprintf(qq{I'd recommend removing %s. Some error occurred }.
1201 qq{while checking its signature, so it could }.
1202 qq{be invalid. Maybe you have configured }.
1203 qq{your 'urllist' with a bad URL. Please check this }.
1204 qq{array with 'o conf urllist' and retry. Or }.
1205 qq{examine the distribution in a subshell. Try
1206 look %s
1207 and run
1208 cpansign -v
1209 },
1210 $self->{localfile},
1211 0 $self->pretty_id,
1212 );
1213 0 $self->{signature_verify} = CPAN::Distrostatus->new("NO");
1214 0 $CPAN::Frontend->mywarn(Text::Wrap::wrap("","",$wrap));
1215 0 ▶ $CPAN::Frontend->mysleep(5) if $CPAN::Frontend->can("mysleep");
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::Frontend->can("mysleep") 0 0 0
if $CPAN::Frontend->can("mysleep") 0 0 0
1216 } else {
1217 0 $self->{signature_verify} = CPAN::Distrostatus->new("YES");
1218 0 ▶ $self->debug("Module::Signature has verified") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
1219 }
1220 } else {
1221 0 $CPAN::Frontend->mywarn(qq{Package came without SIGNATURE\n\n});
1222 }
1223 } else {
1224 0 ▶ $self->debug("Module::Signature is NOT installed") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
1225 }
1226 }
1227 }
1228  
1229 #-> CPAN::Distribution::untar_me ;
1230 7 ▶sub untar_me {
Subroutine untar_me: called CC=2 SCAR=10.7
Pod undocumented
1231 0 ▶ my($self,$ct) = @_;
Subroutine untar_me: not called CC=2 SCAR=10.7
Pod undocumented
1232 0 $self->{archived} = "tar";
1233 0 my $result = eval { $ct->untar() };
1234 0 ▶ if ($result) {
Branch: 2 branches
BranchTrueFalseTotal
if ($result) { } 7 0 7
if ($result) { } 0 0 0
1235 0 $self->{unwrapped} = CPAN::Distrostatus->new("YES");
1236 } else {
1237 # unfortunately we have no $@ here, Tarzip is using mydie which dies with "\n"
1238 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- untar failed");
1239 }
1240 }
1241  
1242 # CPAN::Distribution::unzip_me ;
1243 0 ▶sub unzip_me {
Subroutine unzip_me: not called CC=2 SCAR=17.9
Pod undocumented
1244 0 ▶ my($self,$ct) = @_;
Subroutine unzip_me: not called CC=2 SCAR=17.9
Pod undocumented
1245 0 $self->{archived} = "zip";
1246 0 ▶ if (eval { $ct->unzip() }) {
Branch: 2 branches
BranchTrueFalseTotal
if (eval { do { $ct->unzip } }) { } 0 0 0
if (eval { do { $ct->unzip } }) { } 0 0 0
1247 0 $self->{unwrapped} = CPAN::Distrostatus->new("YES");
1248 } else {
1249 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- unzip failed during unzip");
1250 }
1251 0 return;
1252 }
1253  
1254 0 ▶sub handle_singlefile {
Subroutine handle_singlefile: not called CC=6 SCAR=37.4
Pod undocumented
1255 0 ▶ my($self,$local_file) = @_;
Subroutine handle_singlefile: not called CC=6 SCAR=37.4
Pod undocumented
1256  
1257 0 ▶ if ( $local_file =~ /\.pm(\.(gz|Z))?(?!\n)\Z/ ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($local_file =~ /\.pm(\.(gz|Z))?(?!\n)\Z/) { } 0 0 0
elsif ($local_file =~ /\.patch(\.(gz|bz2))?(?!\n)\Z/) { } 0 0 0
if ($local_file =~ /\.pm(\.(gz|Z))?(?!\n)\Z/) { } 0 0 0
elsif ($local_file =~ /\.patch(\.(gz|bz2))?(?!\n)\Z/) { } 0 0 0
1258 0 $self->{archived} = "pm";
1259 } elsif ( $local_file =~ /\.patch(\.(gz|bz2))?(?!\n)\Z/ ) {
1260 0 $self->{archived} = "patch";
1261 } else {
1262 0 $self->{archived} = "maybe_pl";
1263 }
1264  
1265 0 my $to = File::Basename::basename($local_file);
1266 0 ▶ if ($to =~ s/\.(gz|Z)(?!\n)\Z//) {
Branch: 2 branches
BranchTrueFalseTotal
if ($to =~ s/\.(gz|Z)(?!\n)\Z//) { } 0 0 0
if ($to =~ s/\.(gz|Z)(?!\n)\Z//) { } 0 0 0
1267 0 ▶ if (eval{CPAN::Tarzip->new($local_file)->gunzip($to)}) {
Branch: 2 branches
BranchTrueFalseTotal
if (eval { do { 'CPAN::Tarzip'->new($local_file)->gunzip($to) } }) { } 0 0 0
if (eval { do { 'CPAN::Tarzip'->new($local_file)->gunzip($to) } }) { } 0 0 0
1268 0 $self->{unwrapped} = CPAN::Distrostatus->new("YES");
1269 } else {
1270 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- uncompressing failed");
1271 }
1272 } else {
1273 0 ▶ if (File::Copy::cp($local_file,".")) {
Branch: 2 branches
BranchTrueFalseTotal
if (File::Copy::cp($local_file, '.')) { } 0 0 0
if (File::Copy::cp($local_file, '.')) { } 0 0 0
1274 0 $self->{unwrapped} = CPAN::Distrostatus->new("YES");
1275 } else {
1276 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- copying failed");
1277 }
1278 }
1279 0 return $to;
1280 }
1281  
1282 #-> sub CPAN::Distribution::new ;
1283 93 ▶sub new {
Subroutine new: called CC=1 SCAR=1.2
Pod undocumented
1284 0 ▶ my($class,%att) = @_;
Subroutine new: not called CC=1 SCAR=1.2
Pod undocumented
1285  
1286 # $CPAN::META->{cachemgr} ||= CPAN::CacheMgr->new();
1287  
1288 0 my $this = { %att };
1289 0 return bless $this, $class;
1290 }
1291  
1292 #-> sub CPAN::Distribution::look ;
1293 0 ▶sub look {
Subroutine look: not called CC=10 SCAR=47.0
Pod undocumented
1294 0 ▶ my($self) = @_;
Subroutine look: not called CC=10 SCAR=47.0
Pod undocumented
1295  
1296 0 ▶ if ( $CPAN::Config->{'shell'} ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Config->{'shell'}) { } 0 0 0
if ($CPAN::Config->{'shell'}) { } 0 0 0
1297 0 $CPAN::Frontend->myprint(qq{
1298 Trying to open a subshell in the build directory...
1299 });
1300 } else {
1301 0 $CPAN::Frontend->myprint(qq{
1302 Your configuration does not define a value for subshells.
1303 Please define it with "o conf shell <your shell>"
1304 });
1305 0 return;
1306 }
1307 0 my $dist = $self->id;
1308 0 my $dir;
1309 0 ▶ unless ($dir = $self->dir) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($dir = $self->dir) 0 0 0
unless ($dir = $self->dir) 0 0 0
1310 0 $self->get;
1311 }
1312 0 ▶ unless ($dir ||= $self->dir) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($dir ||= $self->dir) 0 0 0
unless ($dir ||= $self->dir) 0 0 0
Condition0%0/6
$dir ||= $self->dir
l!l&&r!l&&!r
000
$dir ||= $self->dir
l!l&&r!l&&!r
000
MC/DC0%0/2
$dir ||= $self->dir
$dir $self->dir
MC/DC0%0/2
$dir ||= $self->dir
$dir $self->dir
Truth table0%0/3
A ||= B
A= $dirB= $self->dir
ABresult
1X1
011
000
Truth table0%0/3
A ||= B
A= $dirB= $self->dir
ABresult
1X1
011
000
1313 0 $CPAN::Frontend->mywarn(qq{
1314 Could not determine which directory to use for looking at $dist.
1315 });
1316 0 return;
1317 }
1318 0 my $pwd = CPAN::anycwd();
1319 0 $self->safe_chdir($dir);
1320 0 $CPAN::Frontend->myprint(qq{Working directory is $dir\n});
1321 {
1322 0 ▶ local $ENV{CPAN_SHELL_LEVEL} = $ENV{CPAN_SHELL_LEVEL}||0;
Condition0%0/4
$ENV{'CPAN_SHELL_LEVEL'} || 0
l!l
00
$ENV{'CPAN_SHELL_LEVEL'} || 0
l!l
00
MC/DC0%0/1
$ENV{'CPAN_SHELL_LEVEL'} || 0
$ENV{'CPAN_SHELL_LEVEL'}
MC/DC0%0/1
$ENV{'CPAN_SHELL_LEVEL'} || 0
$ENV{'CPAN_SHELL_LEVEL'}
Truth table0%0/2
A
A= $ENV{'CPAN_SHELL_LEVEL'}
Aresult
11
00
Truth table0%0/2
A
A= $ENV{'CPAN_SHELL_LEVEL'}
Aresult
11
00
1323 0 $ENV{CPAN_SHELL_LEVEL} += 1;
1324 0 my $shell = CPAN::HandleConfig->safe_quote($CPAN::Config->{'shell'});
1325  
1326 local $ENV{PERL5LIB} = defined($ENV{PERL5LIB})
1327 ? $ENV{PERL5LIB}
1328 0 ▶ : ($ENV{PERLLIB} || "");
Branch: 2 branches
BranchTrueFalseTotal
defined $ENV{'PERL5LIB'} ? : 0 0 0
defined $ENV{'PERL5LIB'} ? : 0 0 0
Condition0%0/4
$ENV{"PERLLIB"} or ""
l!l
00
$ENV{"PERLLIB"} or ""
l!l
00
MC/DC0%0/1
$ENV{"PERLLIB"} or ""
$ENV{"PERLLIB"}
MC/DC0%0/1
$ENV{"PERLLIB"} or ""
$ENV{"PERLLIB"}
Truth table0%0/2
A
A= $ENV{"PERLLIB"}
Aresult
11
00
Truth table0%0/2
A
A= $ENV{"PERLLIB"}
Aresult
11
00
1329  
1330 0 ▶ local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : "";
Branch: 2 branches
BranchTrueFalseTotal
defined $ENV{'PERL5OPT'} ? : 0 0 0
defined $ENV{'PERL5OPT'} ? : 0 0 0
1331 # local $ENV{PERL_USE_UNSAFE_INC} = exists $ENV{PERL_USE_UNSAFE_INC} ? $ENV{PERL_USE_UNSAFE_INC} : 1; # look
1332 0 $CPAN::META->set_perl5lib;
1333 0 local $ENV{MAKEFLAGS}; # protect us from outer make calls
1334  
1335 0 ▶ unless (system($shell) == 0) {
Branch: 2 branches
BranchTrueFalseTotal
unless (system($shell) == 0) 0 0 0
unless (system($shell) == 0) 0 0 0
1336 0 my $code = $? >> 8;
1337 0 $CPAN::Frontend->mywarn("Subprocess shell exit code $code\n");
1338 }
1339 }
1340 0 $self->safe_chdir($pwd);
1341 }
1342  
1343 # CPAN::Distribution::cvs_import ;
1344 0 ▶sub cvs_import {
Subroutine cvs_import: not called CC=7 SCAR=40.3
Pod undocumented
1345 0 ▶ my($self) = @_;
Subroutine cvs_import: not called CC=7 SCAR=40.3
Pod undocumented
1346 0 $self->get;
1347 0 my $dir = $self->dir;
1348  
1349 0 my $package = $self->called_for;
1350 0 my $module = $CPAN::META->instance('CPAN::Module', $package);
1351 0 my $version = $module->cpan_version;
1352  
1353 0 my $userid = $self->cpan_userid;
1354  
1355 0 my $cvs_dir = (split /\//, $dir)[-1];
1356 0 $cvs_dir =~ s/-\d+[^-]+(?!\n)\Z//;
1357 my $cvs_root =
1358 0 ▶ $CPAN::Config->{cvsroot} || $ENV{CVSROOT};
Condition0%0/6
$CPAN::Config->{'cvsroot'} || $ENV{'CVSROOT'}
l!l&&r!l&&!r
000
$CPAN::Config->{'cvsroot'} || $ENV{'CVSROOT'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$CPAN::Config->{'cvsroot'} || $ENV{'CVSROOT'}
$CPAN::Config->{'cvsroot'} $ENV{'CVSROOT'}
MC/DC0%0/2
$CPAN::Config->{'cvsroot'} || $ENV{'CVSROOT'}
$CPAN::Config->{'cvsroot'} $ENV{'CVSROOT'}
Truth table0%0/3
A || B
A= $CPAN::Config->{'cvsroot'}B= $ENV{'CVSROOT'}
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $CPAN::Config->{'cvsroot'}B= $ENV{'CVSROOT'}
ABresult
1X1
011
000
1359 my $cvs_site_perl =
1360 0 ▶ $CPAN::Config->{cvs_site_perl} || $ENV{CVS_SITE_PERL};
Condition0%0/6
$CPAN::Config->{'cvs_site_perl'} || $ENV{'CVS_SITE_PERL'}
l!l&&r!l&&!r
000
$CPAN::Config->{'cvs_site_perl'} || $ENV{'CVS_SITE_PERL'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$CPAN::Config->{'cvs_site_perl'} || $ENV{'CVS_SITE_PERL'}
$CPAN::Config->{'cvs_site_perl'} $ENV{'CVS_SITE_PERL'}
MC/DC0%0/2
$CPAN::Config->{'cvs_site_perl'} || $ENV{'CVS_SITE_PERL'}
$CPAN::Config->{'cvs_site_perl'} $ENV{'CVS_SITE_PERL'}
Truth table0%0/3
A || B
A= $CPAN::Config->{'cvs_site_perl'}B= $ENV{'CVS_SITE_PERL'}
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $CPAN::Config->{'cvs_site_perl'}B= $ENV{'CVS_SITE_PERL'}
ABresult
1X1
011
000
1361 0 ▶ if ($cvs_site_perl) {
Branch: 2 branches
BranchTrueFalseTotal
if ($cvs_site_perl) 0 0 0
if ($cvs_site_perl) 0 0 0
1362 0 $cvs_dir = "$cvs_site_perl/$cvs_dir";
1363 }
1364 0 my $cvs_log = qq{"imported $package $version sources"};
1365 0 $version =~ s/\./_/g;
1366 # XXX cvs: undocumented and unclear how it was meant to work
1367 0 my @cmd = ('cvs', '-d', $cvs_root, 'import', '-m', $cvs_log,
1368 "$cvs_dir", $userid, "v$version");
1369  
1370 0 my $pwd = CPAN::anycwd();
1371 0 ▶ chdir($dir) or $CPAN::Frontend->mydie(qq{Could not chdir to "$dir": $!});
Branch: 2 branches
BranchTrueFalseTotal
CPAN::Distribution::chdir($dir) or $CPAN::Frontend->mydie(qq[Could not chdir to "$dir": $!]) 0 0 0
CPAN::Distribution::chdir($dir) or $CPAN::Frontend->mydie(qq[Could not chdir to "$dir": $!]) 0 0 0
1372  
1373 0 $CPAN::Frontend->myprint(qq{Working directory is $dir\n});
1374  
1375 0 $CPAN::Frontend->myprint(qq{@cmd\n});
1376 0 ▶ system(@cmd) == 0 or
Branch: 2 branches
BranchTrueFalseTotal
system(@cmd) == 0 or $CPAN::Frontend->mydie("cvs import failed") 0 0 0
system(@cmd) == 0 or $CPAN::Frontend->mydie("cvs import failed") 0 0 0
1377 # XXX cvs
1378 $CPAN::Frontend->mydie("cvs import failed");
1379 0 ▶ chdir($pwd) or $CPAN::Frontend->mydie(qq{Could not chdir to "$pwd": $!});
Branch: 2 branches
BranchTrueFalseTotal
CPAN::Distribution::chdir($pwd) or $CPAN::Frontend->mydie(qq[Could not chdir to "$pwd": $!]) 0 0 0
CPAN::Distribution::chdir($pwd) or $CPAN::Frontend->mydie(qq[Could not chdir to "$pwd": $!]) 0 0 0
1380 }
1381  
1382 #-> sub CPAN::Distribution::readme ;
1383 0 ▶sub readme {
Subroutine readme: not called CC=7 SCAR=40.3
Pod undocumented
1384 0 ▶ my($self) = @_;
Subroutine readme: not called CC=7 SCAR=40.3
Pod undocumented
1385 0 my($dist) = $self->id;
1386 0 my($sans,$suffix) = $dist =~ /(.+)\.(tgz|tar[\._-]gz|tar\.Z|zip)$/;
1387 0 ▶ $self->debug("sans[$sans] suffix[$suffix]\n") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
1388 0 my($local_file);
1389 my($local_wanted) =
1390 File::Spec->catfile(
1391 $CPAN::Config->{keep_source_where},
1392 0 "authors",
1393 "id",
1394 split(/\//,"$sans.readme"),
1395 );
1396 0 my $readme = "authors/id/$sans.readme";
1397 0 ▶ $self->debug("Doing localize for '$readme'") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
1398 0 ▶ $local_file = CPAN::FTP->localize($readme,
Branch: 2 branches
BranchTrueFalseTotal
$local_file = "CPAN::FTP"->localize($readme, $local_wanted) or $CPAN::Frontend->mydie("No $sans.readme found") 0 0 0
$local_file = "CPAN::FTP"->localize($readme, $local_wanted) or $CPAN::Frontend->mydie("No $sans.readme found") 0 0 0
1399 $local_wanted)
1400 or $CPAN::Frontend->mydie(qq{No $sans.readme found});
1401  
1402 0 my $fh_pager = FileHandle->new;
1403 0 local($SIG{PIPE}) = "IGNORE";
1404 0 ▶ my $pager = $CPAN::Config->{'pager'} || "cat";
Condition0%0/4
$CPAN::Config->{'pager'} || 'cat'
l!l
00
$CPAN::Config->{'pager'} || 'cat'
l!l
00
MC/DC0%0/1
$CPAN::Config->{'pager'} || 'cat'
$CPAN::Config->{'pager'}
MC/DC0%0/1
$CPAN::Config->{'pager'} || 'cat'
$CPAN::Config->{'pager'}
Truth table0%0/2
A
A= $CPAN::Config->{'pager'}
Aresult
11
00
Truth table0%0/2
A
A= $CPAN::Config->{'pager'}
Aresult
11
00
1405 0 ▶ $fh_pager->open("|$pager")
Branch: 2 branches
BranchTrueFalseTotal
$fh_pager->open("|$pager") or die "Could not open pager ${pager}: $!" 0 0 0
$fh_pager->open("|$pager") or die "Could not open pager ${pager}: $!" 0 0 0
1406 or die "Could not open pager $pager\: $!";
1407 0 my $fh_readme = FileHandle->new;
1408 0 ▶ $fh_readme->open($local_file)
Branch: 2 branches
BranchTrueFalseTotal
$fh_readme->open($local_file) or $CPAN::Frontend->mydie(qq[Could not open "$local_file": $!]) 0 0 0
$fh_readme->open($local_file) or $CPAN::Frontend->mydie(qq[Could not open "$local_file": $!]) 0 0 0
1409 or $CPAN::Frontend->mydie(qq{Could not open "$local_file": $!});
1410 0 $CPAN::Frontend->myprint(qq{
1411 Displaying file
1412 $local_file
1413 with pager "$pager"
1414 });
1415 0 $fh_pager->print(<$fh_readme>);
1416 0 $fh_pager->close;
1417 }
1418  
1419 #-> sub CPAN::Distribution::verifyCHECKSUM ;
1420 7 ▶sub verifyCHECKSUM {
Subroutine verifyCHECKSUM: called CC=12 SCAR=44.3
Pod undocumented
1421 0 ▶ my($self) = @_;
Subroutine verifyCHECKSUM: not called CC=12 SCAR=44.3
Pod undocumented
1422 EXCUSE: {
1423 0 my @e;
1424 0 ▶ $self->{CHECKSUM_STATUS} ||= "";
Condition25%1/4
$self->{"CHECKSUM_STATUS"} ||= ""
l!l
07
$self->{"CHECKSUM_STATUS"} ||= ""
l!l
00
MC/DC0%0/1
$self->{"CHECKSUM_STATUS"} ||= ""
$self->{"CHECKSUM_STATUS"}
MC/DC0%0/1
$self->{"CHECKSUM_STATUS"} ||= ""
$self->{"CHECKSUM_STATUS"}
Truth table50%1/2
A
A= $self->{"CHECKSUM_STATUS"}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"CHECKSUM_STATUS"}
Aresult
11
00
1425 0 ▶ $self->{CHECKSUM_STATUS} eq "OK" and push @e, "Checksum was ok";
Branch: 2 branches
BranchTrueFalseTotal
$self->{"CHECKSUM_STATUS"} eq "OK" and push @e, "Checksum was ok" 0 7 7
$self->{"CHECKSUM_STATUS"} eq "OK" and push @e, "Checksum was ok" 0 0 0
1426 0 ▶ $CPAN::Frontend->myprint(join "", map {" $_\n"} @e) and return if @e;
Branch: 2 branches
BranchTrueFalseTotal
if @e 0 7 7
if @e 0 0 0
Condition10%1/10
@e && ($CPAN::Frontend->myprint(join('', map({" $_\n";} @e))) && (return))
!ll&&!rl&&r
700
$CPAN::Frontend->myprint(join("", map({" $_\n";} @e))) and return
!ll
00
@e && ($CPAN::Frontend->myprint(join('', map({" $_\n";} @e))) && (return))
!ll&&!rl&&r
000
$CPAN::Frontend->myprint(join("", map({" $_\n";} @e))) and return
!ll
00
MC/DC0%0/2
@e && ($CPAN::Frontend->myprint(join('', map({" $_\n";} @e))) && (return))
@e $CPAN::Frontend->myprint(join("", map({" $_\n";} @e)))
MC/DC0%0/2
@e && ($CPAN::Frontend->myprint(join('', map({" $_\n";} @e))) && (return))
@e $CPAN::Frontend->myprint(join("", map({" $_\n";} @e)))
Truth table33%1/3
A && B
A= @eB= $CPAN::Frontend->myprint(join("", map({" $_\n";} @e)))
ABresult
0X0
100
111
Truth table0%0/3
A && B
A= @eB= $CPAN::Frontend->myprint(join("", map({" $_\n";} @e)))
ABresult
0X0
100
111
1427 }
1428 0 my($lc_want,$lc_file,@local,$basename);
1429 0 @local = split(/\//,$self->id);
1430 0 pop @local;
1431 0 push @local, "CHECKSUMS";
1432 $lc_want =
1433 File::Spec->catfile($CPAN::Config->{keep_source_where},
1434 0 "authors", "id", @local);
1435 0 local($") = "/";
1436 0 ▶ if (my $size = -s $lc_want) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $size = -s $lc_want) 0 7 7
if (my $size = -s $lc_want) 0 0 0
1437 0 ▶ $self->debug("lc_want[$lc_want]size[$size]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
1438 0 my @stat = stat $lc_want;
1439 0 my $epoch_starting_support_of_cpan_path = 1637471530;
1440 0 ▶ if ($stat[9] >= $epoch_starting_support_of_cpan_path) {
Branch: 2 branches
BranchTrueFalseTotal
if ($stat[9] >= $epoch_starting_support_of_cpan_path) { } 0 0 0
if ($stat[9] >= $epoch_starting_support_of_cpan_path) { } 0 0 0
1441 0 ▶ if ($self->CHECKSUM_check_file($lc_want, 1)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->CHECKSUM_check_file($lc_want, 1)) 0 0 0
if ($self->CHECKSUM_check_file($lc_want, 1)) 0 0 0
1442 0 return $self->{CHECKSUM_STATUS} = "OK";
1443 }
1444 } else {
1445 0 unlink $lc_want;
1446 }
1447 }
1448 0 $lc_file = CPAN::FTP->localize("authors/id/@local",
1449 $lc_want,1);
1450 0 ▶ unless ($lc_file) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($lc_file) 0 7 7
unless ($lc_file) 0 0 0
1451 0 $CPAN::Frontend->myprint("Trying $lc_want.gz\n");
1452 0 $local[-1] .= ".gz";
1453 0 $lc_file = CPAN::FTP->localize("authors/id/@local",
1454 "$lc_want.gz",1);
1455 0 ▶ if ($lc_file) {
Branch: 2 branches
BranchTrueFalseTotal
if ($lc_file) { } 0 0 0
if ($lc_file) { } 0 0 0
1456 0 $lc_file =~ s/\.gz(?!\n)\Z//;
1457 0 eval{CPAN::Tarzip->new("$lc_file.gz")->gunzip($lc_file)};
1458 } else {
1459 0 return;
1460 }
1461 }
1462 0 ▶ if ($self->CHECKSUM_check_file($lc_file)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->CHECKSUM_check_file($lc_file)) 7 0 7
if ($self->CHECKSUM_check_file($lc_file)) 0 0 0
1463 0 return $self->{CHECKSUM_STATUS} = "OK";
1464 }
1465 }
1466  
1467 #-> sub CPAN::Distribution::SIG_check_file ;
1468 0 ▶sub SIG_check_file {
Subroutine SIG_check_file: not called CC=3 SCAR=24.8
Pod undocumented
1469 0 ▶ my($self,$chk_file) = @_;
Subroutine SIG_check_file: not called CC=3 SCAR=24.8
Pod undocumented
1470 0 my $rv = eval { Module::Signature::_verify($chk_file) };
1471  
1472 0 ▶ if ($rv eq Module::Signature::CANNOT_VERIFY()) {
Branch: 2 branches
BranchTrueFalseTotal
if ($rv eq Module::Signature::CANNOT_VERIFY()) 0 0 0
if ($rv eq Module::Signature::CANNOT_VERIFY()) 0 0 0
1473 0 $CPAN::Frontend->myprint(qq{\nSignature for }.
1474 qq{file $chk_file could not be verified for an unknown reason. }.
1475 $self->as_string.
1476 qq{Module::Signature verification returned value $rv\n\n}
1477 );
1478  
1479 0 my $wrap = qq{The manual says for this case: Cannot verify the
1480 OpenPGP signature, maybe due to the lack of a network connection to
1481 the key server, or if neither gnupg nor Crypt::OpenPGP exists on the
1482 system. You probably want to analyse the situation and if you cannot
1483 fix it you will have to decide whether you want to stop this session
1484 or you want to turn off signature verification. The latter would be
1485 done with the command 'o conf init check_sigs'};
1486  
1487 0 $CPAN::Frontend->mydie(Text::Wrap::wrap("","",$wrap));
1488 0 ▶ } if ($rv == Module::Signature::SIGNATURE_OK()) {
Branch: 2 branches
BranchTrueFalseTotal
if ($rv == Module::Signature::SIGNATURE_OK()) { } 0 0 0
if ($rv == Module::Signature::SIGNATURE_OK()) { } 0 0 0
1489 0 $CPAN::Frontend->myprint("Signature for $chk_file ok\n");
1490 0 return $self->{SIG_STATUS} = "OK";
1491 } else {
1492 0 $CPAN::Frontend->mywarn(qq{\nSignature invalid for }.
1493 qq{file $chk_file. }.
1494 qq{Please investigate.\n\n}.
1495 $self->as_string.
1496 qq{Module::Signature verification returned value $rv\n\n}
1497 );
1498  
1499 0 my $wrap = qq{I\'d recommend removing $chk_file. Its signature
1500 is invalid. Maybe you have configured your 'urllist' with
1501 a bad URL. Please check this array with 'o conf urllist', and
1502 retry.};
1503  
1504 0 $CPAN::Frontend->mydie(Text::Wrap::wrap("","",$wrap));
1505 }
1506 }
1507  
1508 #-> sub CPAN::Distribution::CHECKSUM_check_file ;
1509  
1510 # sloppy is 1 when we have an old checksums file that maybe is good
1511 # enough
1512  
1513 7 ▶sub CHECKSUM_check_file {
Subroutine CHECKSUM_check_file: called CC=32 SCAR=64.7
Pod undocumented
1514 0 ▶ my($self,$chk_file,$sloppy) = @_;
Subroutine CHECKSUM_check_file: not called CC=32 SCAR=64.7
Pod undocumented
1515 0 my($cksum,$file,$basename);
1516  
1517 0 ▶ $sloppy ||= 0;
Condition25%1/4
$sloppy ||= 0
l!l
07
$sloppy ||= 0
l!l
00
MC/DC0%0/1
$sloppy ||= 0
$sloppy
MC/DC0%0/1
$sloppy ||= 0
$sloppy
Truth table50%1/2
A
A= $sloppy
Aresult
11
00
Truth table0%0/2
A
A= $sloppy
Aresult
11
00
1518 0 ▶ $self->debug("chk_file[$chk_file]sloppy[$sloppy]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
1519 0 my $check_sigs = CPAN::HandleConfig->prefs_lookup($self,
1520 q{check_sigs});
1521 0 ▶ if ($check_sigs) {
Branch: 2 branches
BranchTrueFalseTotal
if ($check_sigs) 0 7 7
if ($check_sigs) 0 0 0
1522 0 ▶ if ($CPAN::META->has_inst("Module::Signature")) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::META->has_inst('Module::Signature')) { } 0 0 0
if ($CPAN::META->has_inst('Module::Signature')) { } 0 0 0
1523 0 ▶ $self->debug("Module::Signature is installed, verifying") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
1524 0 $self->SIG_check_file($chk_file);
1525 } else {
1526 0 ▶ $self->debug("Module::Signature is NOT installed") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
1527 }
1528 }
1529  
1530 0 $file = $self->{localfile};
1531 0 $basename = File::Basename::basename($file);
1532 0 my($signed_data);
1533 0 my $fh = FileHandle->new;
1534 0 ▶ if ($check_sigs) {
Branch: 2 branches
BranchTrueFalseTotal
if ($check_sigs) { } 0 7 7
if ($check_sigs) { } 0 0 0
1535 0 my $tempdir;
1536 0 ▶ if ($CPAN::META->has_usable("File::Temp")) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::META->has_usable('File::Temp')) { } 0 0 0
if ($CPAN::META->has_usable('File::Temp')) { } 0 0 0
1537 0 $tempdir = File::Temp::tempdir("CHECKSUMS-XXXX", CLEANUP => 1, DIR => "/tmp" );
1538 } else {
1539 0 $tempdir = File::Spec->catdir(File::Spec->tmpdir, "CHECKSUMS-$$");
1540 0 File::Path::mkpath($tempdir);
1541 }
1542 0 my $tempfile = File::Spec->catfile($tempdir, "CHECKSUMS.$$");
1543 0 unlink $tempfile; # ignore missing file
1544 0 my $devnull = File::Spec->devnull;
1545 my $gpg = $CPAN::Config->{gpg} or
1546 0 ▶ $CPAN::Frontend->mydie("Your configuration suggests that you do not have 'gpg' installed. This is needed to verify checksums with the config variable 'check_sigs' on. Please configure it with 'o conf init gpg'");
Branch: 2 branches
BranchTrueFalseTotal
my $gpg = $CPAN::Config->{"gpg"} or $CPAN::Frontend->mydie("Your configuration suggests that you do not have 'gpg' installed. This is needed to verify checksums with the config variable 'check_sigs' on. Please configure it with 'o conf init gpg'") 0 0 0
my $gpg = $CPAN::Config->{"gpg"} or $CPAN::Frontend->mydie("Your configuration suggests that you do not have 'gpg' installed. This is needed to verify checksums with the config variable 'check_sigs' on. Please configure it with 'o conf init gpg'") 0 0 0
1547 0 my $system = qq{"$gpg" --verify --batch --no-tty --output "$tempfile" "$chk_file" 2> "$devnull"};
1548 0 ▶ 0 == system $system or $CPAN::Frontend->mydie("gpg run was failing, cannot continue: $system");
Branch: 2 branches
BranchTrueFalseTotal
0 == system($system) or $CPAN::Frontend->mydie("gpg run was failing, cannot continue: $system") 0 0 0
0 == system($system) or $CPAN::Frontend->mydie("gpg run was failing, cannot continue: $system") 0 0 0
1549 0 ▶ open $fh, $tempfile or $CPAN::Frontend->mydie("Could not open $tempfile: $!");
Branch: 2 branches
BranchTrueFalseTotal
open $fh, $tempfile or $CPAN::Frontend->mydie("Could not open ${tempfile}: $!") 0 0 0
open $fh, $tempfile or $CPAN::Frontend->mydie("Could not open ${tempfile}: $!") 0 0 0
1550 0 local $/;
1551 0 $signed_data = <$fh>;
1552 0 close $fh;
1553 0 File::Path::rmtree($tempdir);
1554 } else {
1555 0 my $fh = FileHandle->new;
1556 0 ▶ if (open $fh, $chk_file) {
Branch: 2 branches
BranchTrueFalseTotal
if (open $fh, $chk_file) { } 7 0 7
if (open $fh, $chk_file) { } 0 0 0
1557 0 local($/);
1558 0 $signed_data = <$fh>;
1559 } else {
1560 0 $CPAN::Frontend->mydie("Could not open $chk_file for reading");
1561 }
1562 0 close $fh;
1563 }
1564 0 $signed_data =~ s/\015?\012/\n/g;
1565 0 my($compmt) = Safe->new();
1566 0 $cksum = $compmt->reval($signed_data);
1567 0 ▶ if ($@) {
Branch: 2 branches
BranchTrueFalseTotal
if ($@) 0 7 7
if ($@) 0 0 0
1568 0 rename $chk_file, "$chk_file.bad";
1569 0 ▶ Carp::confess($@) if $@;
Branch: 2 branches
BranchTrueFalseTotal
if $@ 0 0 0
if $@ 0 0 0
1570 }
1571  
1572 0 ▶ if (! ref $cksum or ref $cksum ne "HASH") {
Branch: 8 branches
BranchTrueFalseTotal
if (not ref $cksum or ref $cksum ne 'HASH') { } 0 7 7
elsif (exists $cksum->{$basename} and not exists $cksum->{$basename}{'cpan_path'}) { } 0 7 7
elsif (exists $cksum->{$basename} and substr($self->{'ID'}, 0, length $cksum->{$basename}{'cpan_path'}) ne $cksum->{$basename}{'cpan_path'}) { } 0 7 7
elsif (exists $cksum->{$basename}{'sha256'}) { } 7 0 7
if (not ref $cksum or ref $cksum ne 'HASH') { } 0 0 0
elsif (exists $cksum->{$basename} and not exists $cksum->{$basename}{'cpan_path'}) { } 0 0 0
elsif (exists $cksum->{$basename} and substr($self->{'ID'}, 0, length $cksum->{$basename}{'cpan_path'}) ne $cksum->{$basename}{'cpan_path'}) { } 0 0 0
elsif (exists $cksum->{$basename}{'sha256'}) { } 0 0 0
Condition16%1/6
not ref $cksum or ref $cksum ne "HASH"
l!l&&r!l&&!r
007
not ref $cksum or ref $cksum ne "HASH"
l!l&&r!l&&!r
000
MC/DC0%0/2
not ref $cksum or ref $cksum ne "HASH"
not ref $cksum ref $cksum ne "HASH"
MC/DC0%0/2
not ref $cksum or ref $cksum ne "HASH"
not ref $cksum ref $cksum ne "HASH"
Truth table33%1/3
not(A) or B
A= not ref $cksumB= ref $cksum ne "HASH"
ABresult
1X1
011
000
Truth table0%0/3
not(A) or B
A= not ref $cksumB= ref $cksum ne "HASH"
ABresult
1X1
011
000
1573 0 $CPAN::Frontend->mywarn(qq{
1574 Warning: checksum file '$chk_file' broken.
1575  
1576 When trying to read that file I expected to get a hash reference
1577 for further processing, but got garbage instead.
1578 });
1579 0 my $answer = CPAN::Shell::colorable_makemaker_prompt("Proceed nonetheless?", "no");
1580 0 ▶ $answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n");
Branch: 2 branches
BranchTrueFalseTotal
$answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n") 0 0 0
$answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n") 0 0 0
1581 0 $self->{CHECKSUM_STATUS} = "NIL -- CHECKSUMS file broken";
1582 0 return;
1583 ▶ } elsif (exists $cksum->{$basename} && ! exists $cksum->{$basename}{cpan_path}) {
Condition16%1/6
exists $cksum->{$basename} and not exists $cksum->{$basename}{"cpan_path"}
!ll&&!rl&&r
070
exists $cksum->{$basename} and not exists $cksum->{$basename}{"cpan_path"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $cksum->{$basename} and not exists $cksum->{$basename}{"cpan_path"}
exists $cksum->{$basename} not exists $cksum->{$basename}{"cpan_path"}
MC/DC0%0/2
exists $cksum->{$basename} and not exists $cksum->{$basename}{"cpan_path"}
exists $cksum->{$basename} not exists $cksum->{$basename}{"cpan_path"}
Truth table33%1/3
A and not(B)
A= exists $cksum->{$basename}B= not exists $cksum->{$basename}{"cpan_path"}
ABresult
0X0
100
111
Truth table0%0/3
A and not(B)
A= exists $cksum->{$basename}B= not exists $cksum->{$basename}{"cpan_path"}
ABresult
0X0
100
111
1584 0 $CPAN::Frontend->mywarn(qq{
1585 Warning: checksum file '$chk_file' not conforming.
1586  
1587 The cksum does not contain the key 'cpan_path' for '$basename'.
1588 });
1589 0 my $answer = CPAN::Shell::colorable_makemaker_prompt("Proceed nonetheless?", "no");
1590 0 ▶ $answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n");
Branch: 2 branches
BranchTrueFalseTotal
$answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n") 0 0 0
$answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n") 0 0 0
1591 0 $self->{CHECKSUM_STATUS} = "NIL -- CHECKSUMS file without cpan_path";
1592 0 return;
1593 ▶ } elsif (exists $cksum->{$basename} && substr($self->{ID},0,length($cksum->{$basename}{cpan_path}))
Condition16%1/6
exists $cksum->{$basename} and substr($self->{"ID"}, 0, length $cksum->{$basename}{"cpan_path"}) ne $cksum->{$basename}{"cpan_path"}
!ll&&!rl&&r
070
exists $cksum->{$basename} and substr($self->{"ID"}, 0, length $cksum->{$basename}{"cpan_path"}) ne $cksum->{$basename}{"cpan_path"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $cksum->{$basename} and substr($self->{"ID"}, 0, length $cksum->{$basename}{"cpan_path"}) ne $cksum->{$basename}{"cpan_path"}
exists $cksum->{$basename} substr($self->{"ID"}, 0, length $cksum->{$basename}{"cpan_path"}) ne $cksum->{$basename}{"cpan_path"}
MC/DC0%0/2
exists $cksum->{$basename} and substr($self->{"ID"}, 0, length $cksum->{$basename}{"cpan_path"}) ne $cksum->{$basename}{"cpan_path"}
exists $cksum->{$basename} substr($self->{"ID"}, 0, length $cksum->{$basename}{"cpan_path"}) ne $cksum->{$basename}{"cpan_path"}
Truth table33%1/3
A and B
A= exists $cksum->{$basename}B= substr($self->{"ID"}, 0, length $cksum->{$basename}{"cpan_path"}) ne $cksum->{$basename}{"cpan_path"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= exists $cksum->{$basename}B= substr($self->{"ID"}, 0, length $cksum->{$basename}{"cpan_path"}) ne $cksum->{$basename}{"cpan_path"}
ABresult
0X0
100
111
1594 ne $cksum->{$basename}{cpan_path}) {
1595 0 $CPAN::Frontend->mywarn(qq{
1596 Warning: checksum file not matching path '$self->{ID}'.
1597  
1598 The cksum contain the key 'cpan_path=$cksum->{$basename}{cpan_path}'
1599 which does not match the ID of the distribution '$self->{ID}'.
1600 Something's suspicious might be going on here. Please investigate.
1601  
1602 });
1603 0 my $answer = CPAN::Shell::colorable_makemaker_prompt("Proceed nonetheless?", "no");
1604 0 ▶ $answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n");
Branch: 2 branches
BranchTrueFalseTotal
$answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n") 0 0 0
$answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n") 0 0 0
1605 0 $self->{CHECKSUM_STATUS} = "NIL -- CHECKSUMS non-matching cpan_path vs. ID";
1606 0 return;
1607 } elsif (exists $cksum->{$basename}{sha256}) {
1608 0 ▶ $self->debug("Found checksum for $basename:" .
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
1609 "$cksum->{$basename}{sha256}\n") if $CPAN::DEBUG;
1610  
1611 0 open($fh, $file);
1612 0 binmode $fh;
1613 0 my $eq = $self->eq_CHECKSUM($fh,$cksum->{$basename}{sha256});
1614 0 $fh->close;
1615 0 $fh = CPAN::Tarzip->TIEHANDLE($file);
1616  
1617 0 ▶ unless ($eq) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($eq) 0 7 7
unless ($eq) 0 0 0
1618 0 my $dg = Digest::SHA->new(256);
1619 0 my($data,$ref);
1620 0 $ref = \$data;
1621 0 ▶ while ($fh->READ($ref, 4096) > 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($fh->READ($ref, 4096) > 0) 0 0 0
if ($fh->READ($ref, 4096) > 0) 0 0 0
1622 0 $dg->add($data);
1623 }
1624 0 my $hexdigest = $dg->hexdigest;
1625 0 $eq += $hexdigest eq $cksum->{$basename}{'sha256-ungz'};
1626 }
1627  
1628 0 ▶ if ($eq) {
Branch: 2 branches
BranchTrueFalseTotal
if ($eq) { } 7 0 7
if ($eq) { } 0 0 0
1629 0 $CPAN::Frontend->myprint("Checksum for $file ok\n");
1630 0 return $self->{CHECKSUM_STATUS} = "OK";
1631 } else {
1632 0 $CPAN::Frontend->myprint(qq{\nChecksum mismatch for }.
1633 qq{distribution file. }.
1634 qq{Please investigate.\n\n}.
1635 $self->as_string,
1636 $CPAN::META->instance(
1637 'CPAN::Author',
1638 $self->cpan_userid
1639 )->as_string);
1640  
1641 0 my $wrap = qq{I\'d recommend removing $file. Its
1642 checksum is incorrect. Maybe you have configured your 'urllist' with
1643 a bad URL. Please check this array with 'o conf urllist', and
1644 retry.};
1645  
1646 0 $CPAN::Frontend->mydie(Text::Wrap::wrap("","",$wrap));
1647  
1648 # former versions just returned here but this seems a
1649 # serious threat that deserves a die
1650  
1651 # $CPAN::Frontend->myprint("\n\n");
1652 # sleep 3;
1653 # return;
1654 }
1655 # close $fh if fileno($fh);
1656 } else {
1657 0 ▶ return if $sloppy;
Branch: 2 branches
BranchTrueFalseTotal
if $sloppy 0 0 0
if $sloppy 0 0 0
1658 0 ▶ unless ($self->{CHECKSUM_STATUS}) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($self->{"CHECKSUM_STATUS"}) 0 0 0
unless ($self->{"CHECKSUM_STATUS"}) 0 0 0
1659 0 $CPAN::Frontend->mywarn(qq{
1660 Warning: No checksum for $basename in $chk_file.
1661  
1662 The cause for this may be that the file is very new and the checksum
1663 has not yet been calculated, but it may also be that something is
1664 going awry right now.
1665 });
1666 0 my $answer = CPAN::Shell::colorable_makemaker_prompt("Proceed?", "yes");
1667 0 ▶ $answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n");
Branch: 2 branches
BranchTrueFalseTotal
$answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n") 0 0 0
$answer =~ /^\s*y/i or $CPAN::Frontend->mydie("Aborted.\n") 0 0 0
1668 }
1669 0 $self->{CHECKSUM_STATUS} = "NIL -- distro not in CHECKSUMS file";
1670 0 return;
1671 }
1672 }
1673  
1674 #-> sub CPAN::Distribution::eq_CHECKSUM ;
1675 7 ▶sub eq_CHECKSUM {
Subroutine eq_CHECKSUM: called CC=3 SCAR=15.5
Pod undocumented
1676 0 ▶ my($self,$fh,$expect) = @_;
Subroutine eq_CHECKSUM: not called CC=3 SCAR=15.5
Pod undocumented
1677 0 ▶ if ($CPAN::META->has_inst("Digest::SHA")) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::META->has_inst("Digest::SHA")) 7 0 7
if ($CPAN::META->has_inst("Digest::SHA")) 0 0 0
1678 0 my $dg = Digest::SHA->new(256);
1679 0 my($data);
1680 0 ▶ while (read($fh, $data, 4096)) {
Branch: 2 branches
BranchTrueFalseTotal
if (read $fh, $data, 4096) 7 7 14
if (read $fh, $data, 4096) 0 0 0
1681 0 $dg->add($data);
1682 }
1683 0 my $hexdigest = $dg->hexdigest;
1684 # warn "fh[$fh] hex[$hexdigest] aexp[$expectMD5]";
1685 0 return $hexdigest eq $expect;
1686 }
1687 0 return 1;
1688 }
1689  
1690 #-> sub CPAN::Distribution::force ;
1691  
1692 # Both CPAN::Modules and CPAN::Distributions know if "force" is in
1693 # effect by autoinspection, not by inspecting a global variable. One
1694 # of the reason why this was chosen to work that way was the treatment
1695 # of dependencies. They should not automatically inherit the force
1696 # status. But this has the downside that ^C and die() will return to
1697 # the prompt but will not be able to reset the force_update
1698 # attributes. We try to correct for it currently in the read_metadata
1699 # routine, and immediately before we check for a Signal. I hope this
1700 # works out in one of v1.57_53ff
1701  
1702 # "Force get forgets previous error conditions"
1703  
1704 #-> sub CPAN::Distribution::fforce ;
1705 0 ▶sub fforce {
Subroutine fforce: not called CC=1 SCAR=6.9
Pod undocumented
1706 0 ▶ my($self, $method) = @_;
Subroutine fforce: not called CC=1 SCAR=6.9
Pod undocumented
1707 0 $self->force($method,1);
1708 }
1709  
1710 #-> sub CPAN::Distribution::force ;
1711 0 ▶sub force {
Subroutine force: not called CC=22 SCAR=62.3
Pod undocumented
1712 0 ▶ my($self, $method,$fforce) = @_;
Subroutine force: not called CC=22 SCAR=62.3
Pod undocumented
1713 0 my %phase_map = (
1714 get => [
1715 "unwrapped",
1716 "build_dir",
1717 "archived",
1718 "localfile",
1719 "CHECKSUM_STATUS",
1720 "signature_verify",
1721 "prefs",
1722 "prefs_file",
1723 "prefs_file_doc",
1724 "cleanup_after_install_done",
1725 ],
1726 make => [
1727 "writemakefile",
1728 "make",
1729 "modulebuild",
1730 "prereq_pm",
1731 "cleanup_after_install_done",
1732 ],
1733 test => [
1734 "badtestcnt",
1735 "make_test",
1736 "cleanup_after_install_done",
1737 ],
1738 install => [
1739 "install",
1740 "cleanup_after_install_done",
1741 ],
1742 unknown => [
1743 "reqtype",
1744 "yaml_content",
1745 "cleanup_after_install_done",
1746 ],
1747 );
1748 0 my $methodmatch = 0;
1749 0 my $ldebug = 0;
1750 0 PHASE: for my $phase (qw(unknown get make test install)) { # order matters
1751 0 ▶ $methodmatch = 1 if $fforce || ($method && $phase eq $method);
Branch: 2 branches
BranchTrueFalseTotal
if $fforce or $method and $phase eq $method 0 0 0
if $fforce or $method and $phase eq $method 0 0 0
Condition0%0/12
$fforce or $method and $phase eq $method
l!l&&r!l&&!r
000
$method and $phase eq $method
!ll&&!rl&&r
000
$fforce or $method and $phase eq $method
l!l&&r!l&&!r
000
$method and $phase eq $method
!ll&&!rl&&r
000
MC/DC0%0/3
$fforce or $method and $phase eq $method
$fforce $method $phase eq $method
MC/DC0%0/3
$fforce or $method and $phase eq $method
$fforce $method $phase eq $method
Truth table0%0/4
A or B and C
A= $fforceB= $methodC= $phase eq $method
ABCresult
1XX1
0111
00X0
0100
Truth table0%0/4
A or B and C
A= $fforceB= $methodC= $phase eq $method
ABCresult
1XX1
0111
00X0
0100
1752 0 ▶ next unless $methodmatch;
Branch: 2 branches
BranchTrueFalseTotal
unless $methodmatch 0 0 0
unless $methodmatch 0 0 0
1753 0 ATTRIBUTE: for my $att (@{$phase_map{$phase}}) {
1754 0 ▶ if ($phase eq "get") {
Branch: 4 branches
BranchTrueFalseTotal
if ($phase eq 'get') { } 0 0 0
elsif ($phase eq 'test') { } 0 0 0
if ($phase eq 'get') { } 0 0 0
elsif ($phase eq 'test') { } 0 0 0
1755 0 ▶ if (substr($self->id,-1,1) eq "."
Branch: 2 branches
BranchTrueFalseTotal
if (substr($self->id, -1, 1) eq "." and $att =~ /(unwrapped|build_dir|archived)/) 0 0 0
if (substr($self->id, -1, 1) eq "." and $att =~ /(unwrapped|build_dir|archived)/) 0 0 0
Condition0%0/6
substr($self->id, -1, 1) eq "." and $att =~ /(unwrapped|build_dir|archived)/
!ll&&!rl&&r
000
substr($self->id, -1, 1) eq "." and $att =~ /(unwrapped|build_dir|archived)/
!ll&&!rl&&r
000
MC/DC0%0/2
substr($self->id, -1, 1) eq "." and $att =~ /(unwrapped|build_dir|archived)/
substr($self->id, -1, 1) eq "." $att =~ /(unwrapped|build_dir|archived)/
MC/DC0%0/2
substr($self->id, -1, 1) eq "." and $att =~ /(unwrapped|build_dir|archived)/
substr($self->id, -1, 1) eq "." $att =~ /(unwrapped|build_dir|archived)/
Truth table0%0/3
A and B
A= substr($self->id, -1, 1) eq "."B= $att =~ /(unwrapped|build_dir|archived)/
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= substr($self->id, -1, 1) eq "."B= $att =~ /(unwrapped|build_dir|archived)/
ABresult
0X0
100
111
1756 && $att =~ /(unwrapped|build_dir|archived)/ ) {
1757 # cannot be undone for local distros
1758 0 next ATTRIBUTE;
1759 }
1760 0 ▶ if ($att eq "build_dir"
Branch: 2 branches
BranchTrueFalseTotal
if ($att eq "build_dir" and $self->{"build_dir"} and $CPAN::META->{"is_tested"}) 0 0 0
if ($att eq "build_dir" and $self->{"build_dir"} and $CPAN::META->{"is_tested"}) 0 0 0
Condition0%0/12
$att eq "build_dir" and $self->{"build_dir"} and $CPAN::META->{"is_tested"}
!ll&&!rl&&r
000
$att eq "build_dir" and $self->{"build_dir"}
!ll&&!rl&&r
000
$att eq "build_dir" and $self->{"build_dir"} and $CPAN::META->{"is_tested"}
!ll&&!rl&&r
000
$att eq "build_dir" and $self->{"build_dir"}
!ll&&!rl&&r
000
MC/DC0%0/3
$att eq "build_dir" and $self->{"build_dir"} and $CPAN::META->{"is_tested"}
$att eq "build_dir" $self->{"build_dir"} $CPAN::META->{"is_tested"}
MC/DC0%0/3
$att eq "build_dir" and $self->{"build_dir"} and $CPAN::META->{"is_tested"}
$att eq "build_dir" $self->{"build_dir"} $CPAN::META->{"is_tested"}
Truth table0%0/4
A and B and C
A= $att eq "build_dir"B= $self->{"build_dir"}C= $CPAN::META->{"is_tested"}
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and B and C
A= $att eq "build_dir"B= $self->{"build_dir"}C= $CPAN::META->{"is_tested"}
ABCresult
0XX0
10X0
1100
1111
1761 && $self->{build_dir}
1762 && $CPAN::META->{is_tested}
1763 ) {
1764 0 delete $CPAN::META->{is_tested}{$self->{build_dir}};
1765 }
1766 } elsif ($phase eq "test") {
1767 0 ▶ if ($att eq "make_test"
Branch: 2 branches
BranchTrueFalseTotal
if ($att eq "make_test" and $self->{"make_test"} and $self->{"make_test"}{"COMMANDID"} and $self->{"make_test"}{"COMMANDID"} == $CPAN::CurrentCommandId) 0 0 0
if ($att eq "make_test" and $self->{"make_test"} and $self->{"make_test"}{"COMMANDID"} and $self->{"make_test"}{"COMMANDID"} == $CPAN::CurrentCommandId) 0 0 0
Condition0%0/18
$att eq "make_test" and $self->{"make_test"} and $self->{"make_test"}{"COMMANDID"} and $self->{"make_test"}{"COMMANDID"} == $CPAN::CurrentCommandId
!ll&&!rl&&r
000
$att eq "make_test" and $self->{"make_test"} and $self->{"make_test"}{"COMMANDID"}
!ll&&!rl&&r
000
$att eq "make_test" and $self->{"make_test"}
!ll&&!rl&&r
000
$att eq "make_test" and $self->{"make_test"} and $self->{"make_test"}{"COMMANDID"} and $self->{"make_test"}{"COMMANDID"} == $CPAN::CurrentCommandId
!ll&&!rl&&r
000
$att eq "make_test" and $self->{"make_test"} and $self->{"make_test"}{"COMMANDID"}
!ll&&!rl&&r
000
$att eq "make_test" and $self->{"make_test"}
!ll&&!rl&&r
000
MC/DC0%0/4
$att eq "make_test" and $self->{"make_test"} and $self->{"make_test"}{"COMMANDID"} and $self->{"make_test"}{"COMMANDID"} == $CPAN::CurrentCommandId
$att eq "make_test" $self->{"make_test"} $self->{"make_test"}{"COMMANDID"} $self->{"make_test"}{"COMMANDID"} == $CPAN::CurrentCommandId
MC/DC0%0/4
$att eq "make_test" and $self->{"make_test"} and $self->{"make_test"}{"COMMANDID"} and $self->{"make_test"}{"COMMANDID"} == $CPAN::CurrentCommandId
$att eq "make_test" $self->{"make_test"} $self->{"make_test"}{"COMMANDID"} $self->{"make_test"}{"COMMANDID"} == $CPAN::CurrentCommandId
Truth table0%0/5
A and B and C and D
A= $att eq "make_test"B= $self->{"make_test"}C= $self->{"make_test"}{"COMMANDID"}D= $self->{"make_test"}{"COMMANDID"} == $CPAN::CurrentCommandId
ABCDresult
0XXX0
10XX0
110X0
11100
11111
Truth table0%0/5
A and B and C and D
A= $att eq "make_test"B= $self->{"make_test"}C= $self->{"make_test"}{"COMMANDID"}D= $self->{"make_test"}{"COMMANDID"} == $CPAN::CurrentCommandId
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1768 && $self->{make_test}
1769 && $self->{make_test}{COMMANDID}
1770 && $self->{make_test}{COMMANDID} == $CPAN::CurrentCommandId
1771 ) {
1772 # endless loop too likely
1773 0 next ATTRIBUTE;
1774 }
1775 }
1776 0 delete $self->{$att};
1777 0 ▶ if ($ldebug || $CPAN::DEBUG) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ldebug or $CPAN::DEBUG) 0 0 0
if ($ldebug or $CPAN::DEBUG) 0 0 0
Condition0%0/6
$ldebug or $CPAN::DEBUG
l!l&&r!l&&!r
000
$ldebug or $CPAN::DEBUG
l!l&&r!l&&!r
000
MC/DC0%0/2
$ldebug or $CPAN::DEBUG
$ldebug $CPAN::DEBUG
MC/DC0%0/2
$ldebug or $CPAN::DEBUG
$ldebug $CPAN::DEBUG
Truth table0%0/3
A or B
A= $ldebugB= $CPAN::DEBUG
ABresult
1X1
011
000
Truth table0%0/3
A or B
A= $ldebugB= $CPAN::DEBUG
ABresult
1X1
011
000
1778 # local $CPAN::DEBUG = 16; # Distribution
1779 0 CPAN->debug(sprintf "id[%s]phase[%s]att[%s]", $self->id, $phase, $att);
1780 }
1781 }
1782 }
1783 0 ▶ if ($method && $method =~ /make|test|install/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($method and $method =~ /make|test|install/) 0 0 0
if ($method and $method =~ /make|test|install/) 0 0 0
Condition0%0/6
$method and $method =~ /make|test|install/
!ll&&!rl&&r
000
$method and $method =~ /make|test|install/
!ll&&!rl&&r
000
MC/DC0%0/2
$method and $method =~ /make|test|install/
$method $method =~ /make|test|install/
MC/DC0%0/2
$method and $method =~ /make|test|install/
$method $method =~ /make|test|install/
Truth table0%0/3
A and B
A= $methodB= $method =~ /make|test|install/
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $methodB= $method =~ /make|test|install/
ABresult
0X0
100
111
1784 0 $self->{force_update} = 1; # name should probably have been force_install
1785 }
1786 }
1787  
1788 #-> sub CPAN::Distribution::notest ;
1789 0 ▶sub notest {
Subroutine notest: not called CC=1 SCAR=6.9
Pod undocumented
1790 0 ▶ my($self, $method) = @_;
Subroutine notest: not called CC=1 SCAR=6.9
Pod undocumented
1791 # $CPAN::Frontend->mywarn("XDEBUG: set notest for $self $method");
1792 0 $self->{"notest"}++; # name should probably have been force_install
1793 }
1794  
1795 #-> sub CPAN::Distribution::unnotest ;
1796 0 ▶sub unnotest {
Subroutine unnotest: not called CC=1 SCAR=6.9
Pod undocumented
1797 0 ▶ my($self) = @_;
Subroutine unnotest: not called CC=1 SCAR=6.9
Pod undocumented
1798 # warn "XDEBUG: deleting notest";
1799 0 delete $self->{notest};
1800 }
1801  
1802 #-> sub CPAN::Distribution::unforce ;
1803 0 ▶sub unforce {
Subroutine unforce: not called CC=1 SCAR=6.9
Pod undocumented
1804 0 ▶ my($self) = @_;
Subroutine unforce: not called CC=1 SCAR=6.9
Pod undocumented
1805 0 delete $self->{force_update};
1806 }
1807  
1808 #-> sub CPAN::Distribution::isa_perl ;
1809 8 ▶sub isa_perl {
Subroutine isa_perl: called CC=5 SCAR=29.7
Pod undocumented
1810 0 ▶ my($self) = @_;
Subroutine isa_perl: not called CC=5 SCAR=29.7
Pod undocumented
1811 0 my $file = File::Basename::basename($self->id);
1812 0 ▶ if ($file =~ m{ ^ perl
Branch: 4 branches
BranchTrueFalseTotal
if ($file =~ / ^ perl ( -(5\.\d+\.\d+) | (5)[._-](00[0-5](?:_[0-4][0-9])?) ) \.tar[._-](?:gz|bz2) (?!\n)\Z /sx) { } 0 8 8
elsif ($self->cpan_comment and $self->cpan_comment =~ /isa_perl\(.+?\)/) { } 0 16 16
if ($file =~ / ^ perl ( -(5\.\d+\.\d+) | (5)[._-](00[0-5](?:_[0-4][0-9])?) ) \.tar[._-](?:gz|bz2) (?!\n)\Z /sx) { } 0 0 0
elsif ($self->cpan_comment and $self->cpan_comment =~ /isa_perl\(.+?\)/) { } 0 0 0
1813 (
1814 -(5\.\d+\.\d+)
1815 |
1816 (5)[._-](00[0-5](?:_[0-4][0-9])?)
1817 )
1818 \.tar[._-](?:gz|bz2)
1819 (?!\n)\Z
1820 }xs) {
1821 0 my $perl_version;
1822 0 ▶ if ($2) {
Branch: 2 branches
BranchTrueFalseTotal
if ($2) { } 0 0 0
if ($2) { } 0 0 0
1823 0 $perl_version = $2;
1824 } else {
1825 0 $perl_version = "$3.$4";
1826 }
1827 0 return $perl_version;
1828 ▶ } elsif ($self->cpan_comment
Condition16%1/6
$self->cpan_comment and $self->cpan_comment =~ /isa_perl\(.+?\)/
!ll&&!rl&&r
800
$self->cpan_comment and $self->cpan_comment =~ /isa_perl\(.+?\)/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->cpan_comment and $self->cpan_comment =~ /isa_perl\(.+?\)/
$self->cpan_comment $self->cpan_comment =~ /isa_perl\(.+?\)/
MC/DC0%0/2
$self->cpan_comment and $self->cpan_comment =~ /isa_perl\(.+?\)/
$self->cpan_comment $self->cpan_comment =~ /isa_perl\(.+?\)/
Truth table33%1/3
A and B
A= $self->cpan_commentB= $self->cpan_comment =~ /isa_perl\(.+?\)/
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $self->cpan_commentB= $self->cpan_comment =~ /isa_perl\(.+?\)/
ABresult
0X0
100
111
1829 &&
1830 $self->cpan_comment =~ /isa_perl\(.+?\)/) {
1831 0 return $1;
1832 }
1833 }
1834  
1835  
1836 #-> sub CPAN::Distribution::perl ;
1837 7 ▶sub perl {
Subroutine perl: called CC=2 SCAR=9.6
Pod undocumented
1838 0 ▶ my ($self) = @_;
Subroutine perl: not called CC=2 SCAR=9.6
Pod undocumented
1839 0 ▶ if (! $self) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($self) 0 7 7
unless ($self) 0 0 0
1840 26 ▶ use Carp qw(carp);
Subroutine BEGIN: called CC=1 SCAR=0.0
1841 0 carp __PACKAGE__ . "::perl was called without parameters.";
1842 }
1843 0 return CPAN::HandleConfig->safe_quote($CPAN::Perl);
1844 }
1845  
1846 #-> sub CPAN::Distribution::shortcut_prepare ;
1847 # return values: undef means don't shortcut; 0 means shortcut as fail;
1848 # and 1 means shortcut as success
1849  
1850 7 ▶sub shortcut_prepare {
Subroutine shortcut_prepare: called CC=21 SCAR=55.0
Pod undocumented
1851 0 ▶ my ($self) = @_;
Subroutine shortcut_prepare: not called CC=21 SCAR=55.0
Pod undocumented
1852  
1853 0 ▶ $self->debug("checking archive type[$self->{ID}]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
1854 0 ▶ if (!$self->{archived} || $self->{archived} eq "NO") {
Branch: 2 branches
BranchTrueFalseTotal
if (not $self->{"archived"} or $self->{"archived"} eq "NO") 0 7 7
if (not $self->{"archived"} or $self->{"archived"} eq "NO") 0 0 0
Condition16%1/6
not $self->{"archived"} or $self->{"archived"} eq "NO"
l!l&&r!l&&!r
007
not $self->{"archived"} or $self->{"archived"} eq "NO"
l!l&&r!l&&!r
000
MC/DC0%0/2
not $self->{"archived"} or $self->{"archived"} eq "NO"
not $self->{"archived"} $self->{"archived"} eq "NO"
MC/DC0%0/2
not $self->{"archived"} or $self->{"archived"} eq "NO"
not $self->{"archived"} $self->{"archived"} eq "NO"
Truth table33%1/3
not(A) or B
A= not $self->{"archived"}B= $self->{"archived"} eq "NO"
ABresult
1X1
011
000
Truth table0%0/3
not(A) or B
A= not $self->{"archived"}B= $self->{"archived"} eq "NO"
ABresult
1X1
011
000
1855 0 return $self->goodbye("Is neither a tar nor a zip archive.");
1856 }
1857  
1858 0 ▶ $self->debug("checking unwrapping[$self->{ID}]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
1859 0 ▶ if (!$self->{unwrapped}
Branch: 4 branches
BranchTrueFalseTotal
if (not $self->{"unwrapped"} or UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/) 0 7 7
UNIVERSAL::can($self->{'unwrapped'}, 'failed') ? : 7 0 7
if (not $self->{"unwrapped"} or UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/) 0 0 0
UNIVERSAL::can($self->{'unwrapped'}, 'failed') ? : 0 0 0
Condition16%1/6
not $self->{"unwrapped"} or UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
l!l&&r!l&&!r
007
not $self->{"unwrapped"} or UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
l!l&&r!l&&!r
000
MC/DC0%0/2
not $self->{"unwrapped"} or UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
not $self->{"unwrapped"} UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
MC/DC0%0/2
not $self->{"unwrapped"} or UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
not $self->{"unwrapped"} UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
Truth table33%1/3
not(A) or B
A= not $self->{"unwrapped"}B= UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
ABresult
1X1
011
000
Truth table0%0/3
not(A) or B
A= not $self->{"unwrapped"}B= UNIVERSAL::can($self->{"unwrapped"}, "failed") ? $self->{"unwrapped"}->failed : $self->{"unwrapped"} =~ /^NO/
ABresult
1X1
011
000
1860 || (
1861 UNIVERSAL::can($self->{unwrapped},"failed") ?
1862 $self->{unwrapped}->failed :
1863 $self->{unwrapped} =~ /^NO/
1864 )) {
1865 0 return $self->goodbye("Had problems unarchiving. Please build manually");
1866 }
1867  
1868 0 ▶ $self->debug("checking signature[$self->{ID}]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
1869 0 ▶ if ( ! $self->{force_update}
Branch: 4 branches
BranchTrueFalseTotal
if (not $self->{"force_update"} and exists $self->{"signature_verify"} and UNIVERSAL::can($self->{"signature_verify"}, "failed") ? $self->{"signature_verify"}->failed : $self->{"signature_verify"} =~ /^NO/) 0 7 7
UNIVERSAL::can($self->{'signature_verify'}, 'failed') ? : 0 0 0
if (not $self->{"force_update"} and exists $self->{"signature_verify"} and UNIVERSAL::can($self->{"signature_verify"}, "failed") ? $self->{"signature_verify"}->failed : $self->{"signature_verify"} =~ /^NO/) 0 0 0
UNIVERSAL::can($self->{'signature_verify'}, 'failed') ? : 0 0 0
Condition16%2/12
not $self->{"force_update"} and exists $self->{"signature_verify"} and UNIVERSAL::can($self->{"signature_verify"}, "failed") ? $self->{"signature_verify"}->failed : $self->{"signature_verify"} =~ /^NO/
!ll&&!rl&&r
700
not $self->{"force_update"} and exists $self->{"signature_verify"}
!ll&&!rl&&r
070
not $self->{"force_update"} and exists $self->{"signature_verify"} and UNIVERSAL::can($self->{"signature_verify"}, "failed") ? $self->{"signature_verify"}->failed : $self->{"signature_verify"} =~ /^NO/
!ll&&!rl&&r
000
not $self->{"force_update"} and exists $self->{"signature_verify"}
!ll&&!rl&&r
000
MC/DC0%0/3
not $self->{"force_update"} and exists $self->{"signature_verify"} and UNIVERSAL::can($self->{"signature_verify"}, "failed") ? $self->{"signature_verify"}->failed : $self->{"signature_verify"} =~ /^NO/
not $self->{"force_update"} exists $self->{"signature_verify"} UNIVERSAL::can($self->{"signature_verify"}, "failed") ? $self->{"signature_verify"}->failed : $self->{"signature_verify"} =~ /^NO/
MC/DC0%0/3
not $self->{"force_update"} and exists $self->{"signature_verify"} and UNIVERSAL::can($self->{"signature_verify"}, "failed") ? $self->{"signature_verify"}->failed : $self->{"signature_verify"} =~ /^NO/
not $self->{"force_update"} exists $self->{"signature_verify"} UNIVERSAL::can($self->{"signature_verify"}, "failed") ? $self->{"signature_verify"}->failed : $self->{"signature_verify"} =~ /^NO/
Truth table25%1/4
not(A) and B and C
A= not $self->{"force_update"}B= exists $self->{"signature_verify"}C= UNIVERSAL::can($self->{"signature_verify"}, "failed") ? $self->{"signature_verify"}->failed : $self->{"signature_verify"} =~ /^NO/
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
not(A) and B and C
A= not $self->{"force_update"}B= exists $self->{"signature_verify"}C= UNIVERSAL::can($self->{"signature_verify"}, "failed") ? $self->{"signature_verify"}->failed : $self->{"signature_verify"} =~ /^NO/
ABCresult
0XX0
10X0
1100
1111
1870 && exists $self->{signature_verify}
1871 && (
1872 UNIVERSAL::can($self->{signature_verify},"failed") ?
1873 $self->{signature_verify}->failed :
1874 $self->{signature_verify} =~ /^NO/
1875 )
1876 ) {
1877 0 return $self->goodbye("Did not pass the signature test.");
1878 }
1879  
1880 0 ▶ $self->debug("checking writemakefile[$self->{ID}]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
1881 0 ▶ if ($self->{writemakefile}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{"writemakefile"}) 0 7 7
if ($self->{"writemakefile"}) 0 0 0
1882 0 ▶ if (
Branch: 4 branches
BranchTrueFalseTotal
if (UNIVERSAL::can($self->{'writemakefile'}, 'failed') ? $self->{'writemakefile'}->failed : $self->{'writemakefile'} =~ /^NO/) { } 0 0 0
UNIVERSAL::can($self->{'writemakefile'}, 'failed') ? : 0 0 0
if (UNIVERSAL::can($self->{'writemakefile'}, 'failed') ? $self->{'writemakefile'}->failed : $self->{'writemakefile'} =~ /^NO/) { } 0 0 0
UNIVERSAL::can($self->{'writemakefile'}, 'failed') ? : 0 0 0
1883 UNIVERSAL::can($self->{writemakefile},"failed") ?
1884 $self->{writemakefile}->failed :
1885 $self->{writemakefile} =~ /^NO/
1886 ) {
1887 # XXX maybe a retry would be in order?
1888 my $err = UNIVERSAL::can($self->{writemakefile},"text") ?
1889 $self->{writemakefile}->text :
1890 0 ▶ $self->{writemakefile};
Branch: 2 branches
BranchTrueFalseTotal
UNIVERSAL::can($self->{'writemakefile'}, 'text') ? : 0 0 0
UNIVERSAL::can($self->{'writemakefile'}, 'text') ? : 0 0 0
1891 0 $err =~ s/^NO\s*(--\s+)?//;
1892 0 ▶ $err ||= "Had some problem writing Makefile";
Condition0%0/4
$err ||= "Had some problem writing Makefile"
l!l
00
$err ||= "Had some problem writing Makefile"
l!l
00
MC/DC0%0/1
$err ||= "Had some problem writing Makefile"
$err
MC/DC0%0/1
$err ||= "Had some problem writing Makefile"
$err
Truth table0%0/2
A
A= $err
Aresult
11
00
Truth table0%0/2
A
A= $err
Aresult
11
00
1893 0 $err .= ", not re-running";
1894 0 return $self->goodbye($err);
1895 } else {
1896 0 return $self->success("Has already been prepared");
1897 }
1898 }
1899  
1900 0 ▶ $self->debug("checking configure_requires_later[$self->{ID}]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
1901 0 ▶ if( my $later = $self->{configure_requires_later} ) { # see also undelay
Branch: 2 branches
BranchTrueFalseTotal
if (my $later = $self->{"configure_requires_later"}) 0 7 7
if (my $later = $self->{"configure_requires_later"}) 0 0 0
1902 0 return $self->goodbye($later);
1903 }
1904  
1905 0 return undef; # no shortcut
1906 }
1907  
1908 7 ▶sub prepare {
Subroutine prepare: called CC=60 SCAR=75.5
Pod undocumented
1909 0 ▶ my ($self) = @_;
Subroutine prepare: not called CC=60 SCAR=75.5
Pod undocumented
1910  
1911 0 ▶ $self->get
Branch: 2 branches
BranchTrueFalseTotal
$self->get or return 7 0 7
$self->get or return 0 0 0
1912 or return;
1913  
1914 0 ▶ if ( defined( my $sc = $self->shortcut_prepare) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined(my $sc = $self->shortcut_prepare)) 0 7 7
if (defined(my $sc = $self->shortcut_prepare)) 0 0 0
1915 0 return $sc;
1916 }
1917  
1918 local $ENV{PERL5LIB} = defined($ENV{PERL5LIB})
1919 ? $ENV{PERL5LIB}
1920 0 ▶ : ($ENV{PERLLIB} || "");
Branch: 2 branches
BranchTrueFalseTotal
defined $ENV{'PERL5LIB'} ? : 7 0 7
defined $ENV{'PERL5LIB'} ? : 0 0 0
Condition0%0/4
$ENV{"PERLLIB"} or ""
l!l
00
$ENV{"PERLLIB"} or ""
l!l
00
MC/DC0%0/1
$ENV{"PERLLIB"} or ""
$ENV{"PERLLIB"}
MC/DC0%0/1
$ENV{"PERLLIB"} or ""
$ENV{"PERLLIB"}
Truth table0%0/2
A
A= $ENV{"PERLLIB"}
Aresult
11
00
Truth table0%0/2
A
A= $ENV{"PERLLIB"}
Aresult
11
00
1921 0 ▶ local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : "";
Branch: 2 branches
BranchTrueFalseTotal
defined $ENV{'PERL5OPT'} ? : 7 0 7
defined $ENV{'PERL5OPT'} ? : 0 0 0
1922 local $ENV{PERL_USE_UNSAFE_INC} =
1923 exists $ENV{PERL_USE_UNSAFE_INC} && defined $ENV{PERL_USE_UNSAFE_INC}
1924 0 ▶ ? $ENV{PERL_USE_UNSAFE_INC} : 1; # prepare
Branch: 2 branches
BranchTrueFalseTotal
exists $ENV{'PERL_USE_UNSAFE_INC'} && defined $ENV{'PERL_USE_UNSAFE_INC'} ? : 7 0 7
exists $ENV{'PERL_USE_UNSAFE_INC'} && defined $ENV{'PERL_USE_UNSAFE_INC'} ? : 0 0 0
Condition16%1/6
exists $ENV{"PERL_USE_UNSAFE_INC"} and defined $ENV{"PERL_USE_UNSAFE_INC"}
!ll&&!rl&&r
007
exists $ENV{"PERL_USE_UNSAFE_INC"} and defined $ENV{"PERL_USE_UNSAFE_INC"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $ENV{"PERL_USE_UNSAFE_INC"} and defined $ENV{"PERL_USE_UNSAFE_INC"}
exists $ENV{"PERL_USE_UNSAFE_INC"} defined $ENV{"PERL_USE_UNSAFE_INC"}
MC/DC0%0/2
exists $ENV{"PERL_USE_UNSAFE_INC"} and defined $ENV{"PERL_USE_UNSAFE_INC"}
exists $ENV{"PERL_USE_UNSAFE_INC"} defined $ENV{"PERL_USE_UNSAFE_INC"}
Truth table33%1/3
A and B
A= exists $ENV{"PERL_USE_UNSAFE_INC"}B= defined $ENV{"PERL_USE_UNSAFE_INC"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= exists $ENV{"PERL_USE_UNSAFE_INC"}B= defined $ENV{"PERL_USE_UNSAFE_INC"}
ABresult
0X0
100
111
1925 0 $CPAN::META->set_perl5lib;
1926 0 local $ENV{MAKEFLAGS}; # protect us from outer make calls
1927  
1928 0 ▶ if ($CPAN::Signal) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Signal) 0 7 7
if ($CPAN::Signal) 0 0 0
1929 0 delete $self->{force_update};
1930 0 return;
1931 }
1932  
1933 0 ▶ my $builddir = $self->dir or
Branch: 2 branches
BranchTrueFalseTotal
my $builddir = $self->dir or $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n") 7 0 7
my $builddir = $self->dir or $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n") 0 0 0
1934 $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n");
1935  
1936 0 ▶ unless (chdir $builddir) {
Branch: 2 branches
BranchTrueFalseTotal
unless (CPAN::Distribution::chdir($builddir)) 0 7 7
unless (CPAN::Distribution::chdir($builddir)) 0 0 0
1937 0 $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!");
1938 0 return;
1939 }
1940  
1941 0 ▶ if ($CPAN::Signal) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Signal) 0 7 7
if ($CPAN::Signal) 0 0 0
1942 0 delete $self->{force_update};
1943 0 return;
1944 }
1945  
1946 0 ▶ $self->debug("Changed directory to $builddir") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
1947  
1948 0 ▶ local $ENV{PERL_AUTOINSTALL} = $ENV{PERL_AUTOINSTALL} || '';
Condition25%1/4
$ENV{'PERL_AUTOINSTALL'} || ''
l!l
07
$ENV{'PERL_AUTOINSTALL'} || ''
l!l
00
MC/DC0%0/1
$ENV{'PERL_AUTOINSTALL'} || ''
$ENV{'PERL_AUTOINSTALL'}
MC/DC0%0/1
$ENV{'PERL_AUTOINSTALL'} || ''
$ENV{'PERL_AUTOINSTALL'}
Truth table50%1/2
A
A= $ENV{'PERL_AUTOINSTALL'}
Aresult
11
00
Truth table0%0/2
A
A= $ENV{'PERL_AUTOINSTALL'}
Aresult
11
00
1949 0 ▶ local $ENV{PERL_EXTUTILS_AUTOINSTALL} = $ENV{PERL_EXTUTILS_AUTOINSTALL} || '';
Condition25%1/4
$ENV{'PERL_EXTUTILS_AUTOINSTALL'} || ''
l!l
07
$ENV{'PERL_EXTUTILS_AUTOINSTALL'} || ''
l!l
00
MC/DC0%0/1
$ENV{'PERL_EXTUTILS_AUTOINSTALL'} || ''
$ENV{'PERL_EXTUTILS_AUTOINSTALL'}
MC/DC0%0/1
$ENV{'PERL_EXTUTILS_AUTOINSTALL'} || ''
$ENV{'PERL_EXTUTILS_AUTOINSTALL'}
Truth table50%1/2
A
A= $ENV{'PERL_EXTUTILS_AUTOINSTALL'}
Aresult
11
00
Truth table0%0/2
A
A= $ENV{'PERL_EXTUTILS_AUTOINSTALL'}
Aresult
11
00
1950 0 ▶ $self->choose_MM_or_MB
Branch: 2 branches
BranchTrueFalseTotal
$self->choose_MM_or_MB or return 7 0 7
$self->choose_MM_or_MB or return 0 0 0
1951 or return;
1952  
1953 my $configurator = $self->{configure} ? "Configure"
1954 0 ▶ : $self->{modulebuild} ? "Build.PL"
Branch: 4 branches
BranchTrueFalseTotal
$self->{'configure'} ? : 0 7 7
$self->{'modulebuild'} ? : 0 7 7
$self->{'configure'} ? : 0 0 0
$self->{'modulebuild'} ? : 0 0 0
1955 : "Makefile.PL";
1956  
1957 0 $CPAN::Frontend->myprint("Configuring ".$self->id." with $configurator\n");
1958  
1959 0 ▶ if ($CPAN::Config->{prerequisites_policy} eq "follow") {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Config->{"prerequisites_policy"} eq "follow") 7 0 7
if ($CPAN::Config->{"prerequisites_policy"} eq "follow") 0 0 0
1960 0 ▶ $ENV{PERL_AUTOINSTALL} ||= "--defaultdeps";
Condition25%1/4
$ENV{"PERL_AUTOINSTALL"} ||= "--defaultdeps"
l!l
07
$ENV{"PERL_AUTOINSTALL"} ||= "--defaultdeps"
l!l
00
MC/DC0%0/1
$ENV{"PERL_AUTOINSTALL"} ||= "--defaultdeps"
$ENV{"PERL_AUTOINSTALL"}
MC/DC0%0/1
$ENV{"PERL_AUTOINSTALL"} ||= "--defaultdeps"
$ENV{"PERL_AUTOINSTALL"}
Truth table50%1/2
A
A= $ENV{"PERL_AUTOINSTALL"}
Aresult
11
00
Truth table0%0/2
A
A= $ENV{"PERL_AUTOINSTALL"}
Aresult
11
00
1961 0 ▶ $ENV{PERL_EXTUTILS_AUTOINSTALL} ||= "--defaultdeps";
Condition25%1/4
$ENV{"PERL_EXTUTILS_AUTOINSTALL"} ||= "--defaultdeps"
l!l
07
$ENV{"PERL_EXTUTILS_AUTOINSTALL"} ||= "--defaultdeps"
l!l
00
MC/DC0%0/1
$ENV{"PERL_EXTUTILS_AUTOINSTALL"} ||= "--defaultdeps"
$ENV{"PERL_EXTUTILS_AUTOINSTALL"}
MC/DC0%0/1
$ENV{"PERL_EXTUTILS_AUTOINSTALL"} ||= "--defaultdeps"
$ENV{"PERL_EXTUTILS_AUTOINSTALL"}
Truth table50%1/2
A
A= $ENV{"PERL_EXTUTILS_AUTOINSTALL"}
Aresult
11
00
Truth table0%0/2
A
A= $ENV{"PERL_EXTUTILS_AUTOINSTALL"}
Aresult
11
00
1962 }
1963  
1964 0 my $system;
1965 my $pl_commandline;
1966 0 ▶ if ($self->prefs->{pl}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->prefs->{"pl"}) 0 7 7
if ($self->prefs->{"pl"}) 0 0 0
1967 0 $pl_commandline = $self->prefs->{pl}{commandline};
1968 }
1969 0 ▶ local $ENV{PERL} = defined $ENV{PERL}? $ENV{PERL} : $^X;
Branch: 2 branches
BranchTrueFalseTotal
defined $ENV{'PERL'} ? : 0 7 7
defined $ENV{'PERL'} ? : 0 0 0
1970 0 ▶ local $ENV{PERL5_CPAN_IS_EXECUTING} = $ENV{PERL5_CPAN_IS_EXECUTING} || '';
Condition25%1/4
$ENV{'PERL5_CPAN_IS_EXECUTING'} || ''
l!l
07
$ENV{'PERL5_CPAN_IS_EXECUTING'} || ''
l!l
00
MC/DC0%0/1
$ENV{'PERL5_CPAN_IS_EXECUTING'} || ''
$ENV{'PERL5_CPAN_IS_EXECUTING'}
MC/DC0%0/1
$ENV{'PERL5_CPAN_IS_EXECUTING'} || ''
$ENV{'PERL5_CPAN_IS_EXECUTING'}
Truth table50%1/2
A
A= $ENV{'PERL5_CPAN_IS_EXECUTING'}
Aresult
11
00
Truth table0%0/2
A
A= $ENV{'PERL5_CPAN_IS_EXECUTING'}
Aresult
11
00
1971 0 ▶ local $ENV{PERL_MM_USE_DEFAULT} = 1 if $CPAN::Config->{use_prompt_default};
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::Config->{"use_prompt_default"} 0 7 7
if $CPAN::Config->{"use_prompt_default"} 0 0 0
1972 0 ▶ local $ENV{NONINTERACTIVE_TESTING} = 1 if $CPAN::Config->{use_prompt_default};
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::Config->{"use_prompt_default"} 0 7 7
if $CPAN::Config->{"use_prompt_default"} 0 0 0
1973 0 ▶ if ($pl_commandline) {
Branch: 6 branches
BranchTrueFalseTotal
if ($pl_commandline) { } 0 7 7
elsif ($self->{'configure'}) { } 0 7 7
elsif ($self->{'modulebuild'}) { } 0 7 7
if ($pl_commandline) { } 0 0 0
elsif ($self->{'configure'}) { } 0 0 0
elsif ($self->{'modulebuild'}) { } 0 0 0
1974 0 $system = $pl_commandline;
1975 0 $ENV{PERL} = $^X;
1976 } elsif ($self->{'configure'}) {
1977 0 $system = $self->{'configure'};
1978 } elsif ($self->{modulebuild}) {
1979 0 ▶ my($perl) = $self->perl or die "Couldn\'t find executable perl\n";
Branch: 2 branches
BranchTrueFalseTotal
my($perl) = $self->perl or die "Couldn't find executable perl\n" 0 0 0
my($perl) = $self->perl or die "Couldn't find executable perl\n" 0 0 0
1980 0 my $mbuildpl_arg = $self->_make_phase_arg("pl");
1981 0 ▶ $system = sprintf("%s Build.PL%s",
Branch: 2 branches
BranchTrueFalseTotal
$mbuildpl_arg ? : 0 0 0
$mbuildpl_arg ? : 0 0 0
1982 $perl,
1983 $mbuildpl_arg ? " $mbuildpl_arg" : "",
1984 );
1985 } else {
1986 0 ▶ my($perl) = $self->perl or die "Couldn\'t find executable perl\n";
Branch: 2 branches
BranchTrueFalseTotal
my($perl) = $self->perl or die "Couldn't find executable perl\n" 7 0 7
my($perl) = $self->perl or die "Couldn't find executable perl\n" 0 0 0
1987 0 my $switch = "";
1988 # This needs a handler that can be turned on or off:
1989 # $switch = "-MExtUtils::MakeMaker ".
1990 # "-Mops=:default,:filesys_read,:filesys_open,require,chdir"
1991 # if $] > 5.00310;
1992 0 my $makepl_arg = $self->_make_phase_arg("pl");
1993 $ENV{PERL5_CPAN_IS_EXECUTING} = File::Spec->catfile($self->{build_dir},
1994 0 "Makefile.PL");
1995 0 ▶ $system = sprintf("%s%s Makefile.PL%s",
Branch: 4 branches
BranchTrueFalseTotal
$switch ? : 0 7 7
$makepl_arg ? : 7 0 7
$switch ? : 0 0 0
$makepl_arg ? : 0 0 0
1996 $perl,
1997 $switch ? " $switch" : "",
1998 $makepl_arg ? " $makepl_arg" : "",
1999 );
2000 }
2001 0 my $pl_env;
2002 0 ▶ if ($self->prefs->{pl}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->prefs->{"pl"}) 0 7 7
if ($self->prefs->{"pl"}) 0 0 0
2003 0 $pl_env = $self->prefs->{pl}{env};
2004 }
2005 0 ▶ local @ENV{keys %$pl_env} = values %$pl_env if $pl_env;
Branch: 2 branches
BranchTrueFalseTotal
if $pl_env 0 7 7
if $pl_env 0 0 0
2006 0 ▶ if (exists $self->{writemakefile}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $self->{'writemakefile'}) { } 0 7 7
if (exists $self->{'writemakefile'}) { } 0 0 0
2007 } else {
2008 0 ▶ local($SIG{ALRM}) = sub { die "inactivity_timeout reached\n" };
Subroutine __ANON__: not called CC=1 SCAR=2.6
2009 0 my($ret,$pid,$output);
2010 0 $@ = "";
2011 0 my $go_via_alarm;
2012 0 ▶ if ($CPAN::Config->{inactivity_timeout}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Config->{"inactivity_timeout"}) 0 7 7
if ($CPAN::Config->{"inactivity_timeout"}) 0 0 0
2013 0 require Config;
2014 0 ▶ if ($Config::Config{d_alarm}
Branch: 2 branches
BranchTrueFalseTotal
if ($Config::Config{'d_alarm'} and $Config::Config{'d_alarm'} eq 'define') { } 0 0 0
if ($Config::Config{'d_alarm'} and $Config::Config{'d_alarm'} eq 'define') { } 0 0 0
Condition0%0/6
$Config::Config{"d_alarm"} and $Config::Config{"d_alarm"} eq "define"
!ll&&!rl&&r
000
$Config::Config{"d_alarm"} and $Config::Config{"d_alarm"} eq "define"
!ll&&!rl&&r
000
MC/DC0%0/2
$Config::Config{"d_alarm"} and $Config::Config{"d_alarm"} eq "define"
$Config::Config{"d_alarm"} $Config::Config{"d_alarm"} eq "define"
MC/DC0%0/2
$Config::Config{"d_alarm"} and $Config::Config{"d_alarm"} eq "define"
$Config::Config{"d_alarm"} $Config::Config{"d_alarm"} eq "define"
Truth table0%0/3
A and B
A= $Config::Config{"d_alarm"}B= $Config::Config{"d_alarm"} eq "define"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $Config::Config{"d_alarm"}B= $Config::Config{"d_alarm"} eq "define"
ABresult
0X0
100
111
2015 &&
2016 $Config::Config{d_alarm} eq "define"
2017 ) {
2018 0 $go_via_alarm++
2019 } else {
2020 0 $CPAN::Frontend->mywarn("Warning: you have configured the config ".
2021 "variable 'inactivity_timeout' to ".
2022 "'$CPAN::Config->{inactivity_timeout}'. But ".
2023 "on this machine the system call 'alarm' ".
2024 "isn't available. This means that we cannot ".
2025 "provide the feature of intercepting long ".
2026 "waiting code and will turn this feature off.\n"
2027 );
2028 0 $CPAN::Config->{inactivity_timeout} = 0;
2029 }
2030 }
2031 0 ▶ if ($go_via_alarm) {
Branch: 2 branches
BranchTrueFalseTotal
if ($go_via_alarm) { } 0 7 7
if ($go_via_alarm) { } 0 0 0
2032 0 ▶ if ( $self->_should_report('pl') ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->_should_report('pl')) { } 0 0 0
if ($self->_should_report('pl')) { } 0 0 0
2033 ($output, $ret) = CPAN::Reporter::record_command(
2034 $system,
2035 $CPAN::Config->{inactivity_timeout},
2036 0 );
2037 0 CPAN::Reporter::grade_PL( $self, $system, $output, $ret );
2038 }
2039 else {
2040 0 eval {
2041 0 alarm $CPAN::Config->{inactivity_timeout};
2042 0 local $SIG{CHLD}; # = sub { wait };
2043 0 ▶ if (defined($pid = fork)) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined($pid = fork)) { } 0 0 0
if (defined($pid = fork)) { } 0 0 0
2044 0 ▶ if ($pid) { #parent
Branch: 2 branches
BranchTrueFalseTotal
if ($pid) { } 0 0 0
if ($pid) { } 0 0 0
2045 # wait;
2046 0 waitpid $pid, 0;
2047 } else { #child
2048 # note, this exec isn't necessary if
2049 # inactivity_timeout is 0. On the Mac I'd
2050 # suggest, we set it always to 0.
2051 0 exec $system;
2052 }
2053 } else {
2054 0 $CPAN::Frontend->myprint("Cannot fork: $!");
2055 0 return;
2056 }
2057 };
2058 0 alarm 0;
2059 0 ▶ if ($@) {
Branch: 2 branches
BranchTrueFalseTotal
if ($@) 0 0 0
if ($@) 0 0 0
2060 0 kill 9, $pid;
2061 0 waitpid $pid, 0;
2062 0 my $err = "$@";
2063 0 $CPAN::Frontend->myprint($err);
2064 0 $self->{writemakefile} = CPAN::Distrostatus->new("NO $err");
2065 0 $@ = "";
2066 0 $self->store_persistent_state;
2067 0 return $self->goodbye("$system -- TIMED OUT");
2068 }
2069 }
2070 } else {
2071 0 ▶ if (my $expect_model = $self->_prefs_with_expect("pl")) {
Branch: 4 branches
BranchTrueFalseTotal
if (my $expect_model = $self->_prefs_with_expect('pl')) { } 0 7 7
elsif ($self->_should_report('pl')) { } 0 7 7
if (my $expect_model = $self->_prefs_with_expect('pl')) { } 0 0 0
elsif ($self->_should_report('pl')) { } 0 0 0
2072 # XXX probably want to check _should_report here and warn
2073 # about not being able to use CPAN::Reporter with expect
2074 0 $ret = $self->_run_via_expect($system,'writemakefile',$expect_model);
2075 0 ▶ if (! defined $ret
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $ret and $self->{"writemakefile"} and $self->{"writemakefile"}->failed) 0 0 0
if (not defined $ret and $self->{"writemakefile"} and $self->{"writemakefile"}->failed) 0 0 0
Condition0%0/12
not defined $ret and $self->{"writemakefile"} and $self->{"writemakefile"}->failed
!ll&&!rl&&r
000
not defined $ret and $self->{"writemakefile"}
!ll&&!rl&&r
000
not defined $ret and $self->{"writemakefile"} and $self->{"writemakefile"}->failed
!ll&&!rl&&r
000
not defined $ret and $self->{"writemakefile"}
!ll&&!rl&&r
000
MC/DC0%0/3
not defined $ret and $self->{"writemakefile"} and $self->{"writemakefile"}->failed
not defined $ret $self->{"writemakefile"} $self->{"writemakefile"}->failed
MC/DC0%0/3
not defined $ret and $self->{"writemakefile"} and $self->{"writemakefile"}->failed
not defined $ret $self->{"writemakefile"} $self->{"writemakefile"}->failed
Truth table0%0/4
not(A) and B and C
A= not defined $retB= $self->{"writemakefile"}C= $self->{"writemakefile"}->failed
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
not(A) and B and C
A= not defined $retB= $self->{"writemakefile"}C= $self->{"writemakefile"}->failed
ABCresult
0XX0
10X0
1100
1111
2076 && $self->{writemakefile}
2077 && $self->{writemakefile}->failed) {
2078 # timeout
2079 0 return;
2080 }
2081 }
2082 elsif ( $self->_should_report('pl') ) {
2083 0 ($output, $ret) = eval { CPAN::Reporter::record_command($system) };
2084 0 ▶ if (! defined $output or $@) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $output or $@) 0 0 0
if (not defined $output or $@) 0 0 0
Condition0%0/6
not defined $output or $@
l!l&&r!l&&!r
000
not defined $output or $@
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $output or $@
not defined $output $@
MC/DC0%0/2
not defined $output or $@
not defined $output $@
Truth table0%0/3
not(A) or B
A= not defined $outputB= $@
ABresult
1X1
011
000
Truth table0%0/3
not(A) or B
A= not defined $outputB= $@
ABresult
1X1
011
000
2085 0 ▶ my $err = $@ || "Unknown error";
Condition0%0/4
$@ || 'Unknown error'
l!l
00
$@ || 'Unknown error'
l!l
00
MC/DC0%0/1
$@ || 'Unknown error'
$@
MC/DC0%0/1
$@ || 'Unknown error'
$@
Truth table0%0/2
A
A= $@
Aresult
11
00
Truth table0%0/2
A
A= $@
Aresult
11
00
2086 0 $CPAN::Frontend->mywarn("Error while running PL phase: $err\n");
2087 0 $self->{writemakefile} = CPAN::Distrostatus
2088 ->new("NO '$system' returned status $ret and no output");
2089 0 return $self->goodbye("$system -- NOT OK");
2090 }
2091 0 CPAN::Reporter::grade_PL( $self, $system, $output, $ret );
2092 }
2093 else {
2094 0 $ret = system($system);
2095 }
2096 0 ▶ if ($ret != 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ret != 0) 3 4 7
if ($ret != 0) 0 0 0
2097 0 $self->{writemakefile} = CPAN::Distrostatus
2098 ->new("NO '$system' returned status $ret");
2099 0 $CPAN::Frontend->mywarn("Warning: No success on command[$system]\n");
2100 0 $self->store_persistent_state;
2101 0 return $self->goodbye("$system -- NOT OK");
2102 }
2103 }
2104 0 ▶ if (-f "Makefile" || -f "Build" || ($^O eq 'VMS' && (-f 'descrip.mms' || -f 'Build.com'))) {
Branch: 2 branches
BranchTrueFalseTotal
if (-f 'Makefile' or -f 'Build' or $^O eq 'VMS' and -f 'descrip.mms' || -f 'Build.com') { } 4 0 4
if (-f 'Makefile' or -f 'Build' or $^O eq 'VMS' and -f 'descrip.mms' || -f 'Build.com') { } 0 0 0
Condition8%2/24
-f "Makefile" or -f "Build" or $^O eq "VMS" and -f "descrip.mms" || -f "Build.com"
l!l&&r!l&&!r
400
-f "Makefile" or -f "Build"
l!l&&r!l&&!r
400
$^O eq "VMS" and -f "descrip.mms" || -f "Build.com"
!ll&&!rl&&r
000
-f "descrip.mms" or -f "Build.com"
l!l&&r!l&&!r
000
-f "Makefile" or -f "Build" or $^O eq "VMS" and -f "descrip.mms" || -f "Build.com"
l!l&&r!l&&!r
000
-f "Makefile" or -f "Build"
l!l&&r!l&&!r
000
$^O eq "VMS" and -f "descrip.mms" || -f "Build.com"
!ll&&!rl&&r
000
-f "descrip.mms" or -f "Build.com"
l!l&&r!l&&!r
000
MC/DC0%0/5
-f "Makefile" or -f "Build" or $^O eq "VMS" and -f "descrip.mms" || -f "Build.com"
-f "Makefile" -f "Build" $^O eq "VMS" -f "descrip.mms" -f "Build.com"
MC/DC0%0/5
-f "Makefile" or -f "Build" or $^O eq "VMS" and -f "descrip.mms" || -f "Build.com"
-f "Makefile" -f "Build" $^O eq "VMS" -f "descrip.mms" -f "Build.com"
Truth table16%1/6
A or B or C and D or E
A= -f "Makefile"B= -f "Build"C= $^O eq "VMS"D= -f "descrip.mms"E= -f "Build.com"
ABCDEresult
1XXXX1
01XXX1
0011X1
001011
000XX0
001000
Truth table0%0/6
A or B or C and D or E
A= -f "Makefile"B= -f "Build"C= $^O eq "VMS"D= -f "descrip.mms"E= -f "Build.com"
ABCDEresult
1XXXX1
01XXX1
0011X1
001011
000XX0
001000
2105 0 $self->{writemakefile} = CPAN::Distrostatus->new("YES");
2106 0 delete $self->{make_clean}; # if cleaned before, enable next
2107 0 $self->store_persistent_state;
2108 0 return $self->success("$system -- OK");
2109 } else {
2110 0 ▶ my $makefile = $self->{modulebuild} ? "Build" : "Makefile";
Branch: 2 branches
BranchTrueFalseTotal
$self->{'modulebuild'} ? : 0 0 0
$self->{'modulebuild'} ? : 0 0 0
2111 0 my $why = "No '$makefile' created";
2112 0 $CPAN::Frontend->mywarn($why);
2113 0 $self->{writemakefile} = CPAN::Distrostatus
2114 ->new(qq{NO -- $why\n});
2115 0 $self->store_persistent_state;
2116 0 return $self->goodbye("$system -- NOT OK");
2117 }
2118 }
2119 0 $self->store_persistent_state;
2120 0 return 1; # success
2121 }
2122  
2123 #-> sub CPAN::Distribution::shortcut_make ;
2124 # return values: undef means don't shortcut; 0 means shortcut as fail;
2125 # and 1 means shortcut as success
2126 4 ▶sub shortcut_make {
Subroutine shortcut_make: called CC=7 SCAR=32.9
Pod undocumented
2127 4 my ($self) = @_;
2128  
2129 4 ▶ $self->debug("checking make/build results[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 4 4
2130 4 ▶ if (defined $self->{make}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"make"}) 0 4 4
2131 0 ▶ if (UNIVERSAL::can($self->{make},"failed") ?
Branch: 2 branches
BranchTrueFalseTotal
if (UNIVERSAL::can($self->{'make'}, 'failed') ? $self->{'make'}->failed : $self->{'make'} =~ /^NO/) { } 0 0 0
UNIVERSAL::can($self->{'make'}, 'failed') ? : 0 0 0
2132 $self->{make}->failed :
2133 $self->{make} =~ /^NO/
2134 ) {
2135 0 ▶ if ($self->{force_update}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'force_update'}) { } 0 0 0
2136 # Trying an already failed 'make' (unless somebody else blocks)
2137 0 return undef; # no shortcut
2138 } else {
2139 # introduced for turning recursion detection into a distrostatus
2140 my $error = length $self->{make}>3
2141 0 ▶ ? substr($self->{make},3) : "Unknown error";
Branch: 1 branch
BranchTrueFalseTotal
length $self->{'make'} > 3 ? : 0 0 0
2142 0 $self->store_persistent_state;
2143 0 return $self->goodbye("Could not make: $error\n");
2144 }
2145 } else {
2146 0 return $self->success("Has already been made")
2147 }
2148 }
2149 4 return undef; # no shortcut
2150 }
2151  
2152 #-> sub CPAN::Distribution::make ;
2153 7 ▶sub make {
Subroutine make: called CC=46 SCAR=58.5
Pod undocumented
2154 7 my($self) = @_;
2155  
2156 7 $self->pre_make();
2157  
2158 7 ▶ if (exists $self->{cleanup_after_install_done}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"cleanup_after_install_done"}) 0 7 7
2159 0 $self->post_make();
2160 0 return $self->get;
2161 }
2162  
2163 7 ▶ $self->debug("checking goto id[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
2164 7 ▶ if (my $goto = $self->prefs->{goto}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $goto = $self->prefs->{"goto"}) 0 7 7
2165 0 $self->post_make();
2166 0 return $self->goto($goto);
2167 }
2168 # Emergency brake if they said install Pippi and get newest perl
2169  
2170 # XXX Would this make more sense in shortcut_prepare, since
2171 # that doesn't make sense on a perl dist either? Broader
2172 # question: what is the purpose of suggesting force install
2173 # on a perl distribution? That seems unlikely to result in
2174 # such a dependency being satisfied, even if the perl is
2175 # successfully installed. This situation is tantamount to
2176 # a prereq on a version of perl greater than the current one
2177 # so I think we should just abort. -- xdg, 2012-04-06
2178 7 ▶ if ($self->isa_perl) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->isa_perl) 0 7 7
2179 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($self->called_for ne $self->id and not $self->{"force_update"}) 0 0 0
Condition0%0/3
$self->called_for ne $self->id and not $self->{"force_update"}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->called_for ne $self->id and not $self->{"force_update"}
$self->called_for ne $self->id not $self->{"force_update"}
Truth table0%0/3
A and not(B)
A= $self->called_for ne $self->idB= not $self->{"force_update"}
ABresult
0X0
100
111
2180 $self->called_for ne $self->id &&
2181 ! $self->{force_update}
2182 ) {
2183 # if we die here, we break bundles
2184 0 $CPAN::Frontend
2185 ->mywarn(sprintf(
2186 qq{The most recent version "%s" of the module "%s"
2187 is part of the perl-%s distribution. To install that, you need to run
2188 force install %s --or--
2189 install %s
2190 },
2191 $CPAN::META->instance(
2192 'CPAN::Module',
2193 $self->called_for
2194 )->cpan_version,
2195 $self->called_for,
2196 $self->isa_perl,
2197 $self->called_for,
2198 $self->pretty_id,
2199 ));
2200 0 $self->{make} = CPAN::Distrostatus->new("NO isa perl");
2201 0 $CPAN::Frontend->mysleep(1);
2202 0 $self->post_make();
2203 0 return;
2204 }
2205 }
2206  
2207 7 ▶ unless ($self->prepare){
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->prepare) 3 4 7
2208 3 $self->post_make();
2209 3 return;
2210 }
2211  
2212 4 ▶ if ( defined( my $sc = $self->shortcut_make) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $sc = $self->shortcut_make)) 0 4 4
2213 0 $self->post_make();
2214 0 return $sc;
2215 }
2216  
2217 4 ▶ if ($CPAN::Signal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Signal) 0 4 4
2218 0 delete $self->{force_update};
2219 0 $self->post_make();
2220 0 return;
2221 }
2222  
2223 4 ▶ my $builddir = $self->dir or
Branch: 1 branch
BranchTrueFalseTotal
my $builddir = $self->dir or $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n") 4 0 4
2224 $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n");
2225  
2226 4 ▶ unless (chdir $builddir) {
Branch: 1 branch
BranchTrueFalseTotal
unless (CPAN::Distribution::chdir($builddir)) 0 4 4
2227 0 $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!");
2228 0 $self->post_make();
2229 0 return;
2230 }
2231  
2232 4 ▶ my $make = $self->{modulebuild} ? "Build" : "make";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'modulebuild'} ? : 0 4 4
2233 4 $CPAN::Frontend->myprint(sprintf "Running %s for %s\n", $make, $self->id);
2234 local $ENV{PERL5LIB} = defined($ENV{PERL5LIB})
2235 ? $ENV{PERL5LIB}
2236 4 ▶ : ($ENV{PERLLIB} || "");
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL5LIB'} ? : 4 0 4
Condition0%0/2
$ENV{"PERLLIB"} or ""
l!l
00
MC/DC0%0/1
$ENV{"PERLLIB"} or ""
$ENV{"PERLLIB"}
Truth table0%0/2
A
A= $ENV{"PERLLIB"}
Aresult
11
00
2237 4 ▶ local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : "";
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL5OPT'} ? : 4 0 4
2238 local $ENV{PERL_USE_UNSAFE_INC} =
2239 exists $ENV{PERL_USE_UNSAFE_INC} && defined $ENV{PERL_USE_UNSAFE_INC}
2240 4 ▶ ? $ENV{PERL_USE_UNSAFE_INC} : 1; # make
Branch: 1 branch
BranchTrueFalseTotal
exists $ENV{'PERL_USE_UNSAFE_INC'} && defined $ENV{'PERL_USE_UNSAFE_INC'} ? : 4 0 4
Condition33%1/3
exists $ENV{"PERL_USE_UNSAFE_INC"} and defined $ENV{"PERL_USE_UNSAFE_INC"}
!ll&&!rl&&r
004
MC/DC0%0/2
exists $ENV{"PERL_USE_UNSAFE_INC"} and defined $ENV{"PERL_USE_UNSAFE_INC"}
exists $ENV{"PERL_USE_UNSAFE_INC"} defined $ENV{"PERL_USE_UNSAFE_INC"}
Truth table33%1/3
A and B
A= exists $ENV{"PERL_USE_UNSAFE_INC"}B= defined $ENV{"PERL_USE_UNSAFE_INC"}
ABresult
0X0
100
111
2241 4 $CPAN::META->set_perl5lib;
2242 4 local $ENV{MAKEFLAGS}; # protect us from outer make calls
2243  
2244 4 ▶ if ($CPAN::Signal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Signal) 0 4 4
2245 0 delete $self->{force_update};
2246 0 $self->post_make();
2247 0 return;
2248 }
2249  
2250 4 my %env;
2251 4 ▶ while (my($k,$v) = each %ENV) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %ENV) 148 4 152
2252 148 ▶ next if defined $v;
Branch: 1 branch
BranchTrueFalseTotal
if defined $v 144 4 148
2253 4 $env{$k} = '';
2254 }
2255 4 local @ENV{keys %env} = values %env;
2256 4 my $satisfied = eval { $self->satisfy_requires };
2257 4 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 4 4
2258 0 return $self->goodbye($@);
2259 }
2260 4 ▶ unless ($satisfied){
Branch: 1 branch
BranchTrueFalseTotal
unless ($satisfied) 0 4 4
2261 0 $self->post_make();
2262 0 return;
2263 }
2264 4 ▶ if ($CPAN::Signal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Signal) 0 4 4
2265 0 delete $self->{force_update};
2266 0 $self->post_make();
2267 0 return;
2268 }
2269  
2270 # need to chdir again, because $self->satisfy_requires might change the directory
2271 4 ▶ unless (chdir $builddir) {
Branch: 1 branch
BranchTrueFalseTotal
unless (CPAN::Distribution::chdir($builddir)) 0 4 4
2272 0 $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!");
2273 0 $self->post_make();
2274 0 return;
2275 }
2276  
2277 4 my $system;
2278 my $make_commandline;
2279 4 ▶ if ($self->prefs->{make}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->prefs->{"make"}) 0 4 4
2280 0 $make_commandline = $self->prefs->{make}{commandline};
2281 }
2282 4 ▶ local $ENV{PERL} = defined $ENV{PERL}? $ENV{PERL} : $^X;
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL'} ? : 0 4 4
2283 4 ▶ local $ENV{PERL_MM_USE_DEFAULT} = 1 if $CPAN::Config->{use_prompt_default};
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::Config->{"use_prompt_default"} 0 4 4
2284 4 ▶ local $ENV{NONINTERACTIVE_TESTING} = 1 if $CPAN::Config->{use_prompt_default};
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::Config->{"use_prompt_default"} 0 4 4
2285 4 ▶ if ($make_commandline) {
Branch: 1 branch
BranchTrueFalseTotal
if ($make_commandline) { } 0 4 4
2286 0 $system = $make_commandline;
2287 0 $ENV{PERL} = CPAN::find_perl();
2288 } else {
2289 4 ▶ if ($self->{modulebuild}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'modulebuild'}) { } 0 4 4
2290 0 ▶ unless (-f "Build" || ($^O eq 'VMS' && -f 'Build.com')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f "Build" or $^O eq "VMS" and -f "Build.com") 0 0 0
Condition0%0/6
-f "Build" or $^O eq "VMS" and -f "Build.com"
l!l&&r!l&&!r
000
$^O eq "VMS" and -f "Build.com"
!ll&&!rl&&r
000
MC/DC0%0/3
-f "Build" or $^O eq "VMS" and -f "Build.com"
-f "Build" $^O eq "VMS" -f "Build.com"
Truth table0%0/4
A or B and C
A= -f "Build"B= $^O eq "VMS"C= -f "Build.com"
ABCresult
1XX1
0111
00X0
0100
2291 0 my $cwd = CPAN::anycwd();
2292 0 $CPAN::Frontend->mywarn("Alert: no Build file available for 'make $self->{id}'".
2293 " in cwd[$cwd]. Danger, Will Robinson!\n");
2294 0 $CPAN::Frontend->mysleep(5);
2295 }
2296 0 $system = join " ", $self->_build_command(), $CPAN::Config->{mbuild_arg};
2297 } else {
2298 4 $system = join " ", $self->_make_command(), $CPAN::Config->{make_arg};
2299 }
2300 4 $system =~ s/\s+$//;
2301 4 my $make_arg = $self->_make_phase_arg("make");
2302 4 ▶ $system = sprintf("%s%s",
Branch: 1 branch
BranchTrueFalseTotal
$make_arg ? : 0 4 4
2303 $system,
2304 $make_arg ? " $make_arg" : "",
2305 );
2306 }
2307 4 my $make_env;
2308 4 ▶ if ($self->prefs->{make}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->prefs->{"make"}) 0 4 4
2309 0 $make_env = $self->prefs->{make}{env};
2310 }
2311 4 ▶ local @ENV{keys %$make_env} = values %$make_env if $make_env;
Branch: 1 branch
BranchTrueFalseTotal
if $make_env 0 4 4
2312 4 my $expect_model = $self->_prefs_with_expect("make");
2313 4 my $want_expect = 0;
2314 0 ▶ if ( $expect_model && @{$expect_model->{talk}} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expect_model and @{$expect_model->{"talk"};}) 0 4 4
Condition33%1/3
$expect_model and @{$expect_model->{"talk"};}
!ll&&!rl&&r
400
MC/DC0%0/2
$expect_model and @{$expect_model->{"talk"};}
$expect_model @{$expect_model->{"talk"};}
Truth table33%1/3
A and B
A= $expect_modelB= @{$expect_model->{"talk"};}
ABresult
0X0
100
111
2315 0 my $can_expect = $CPAN::META->has_inst("Expect");
2316 0 ▶ if ($can_expect) {
Branch: 1 branch
BranchTrueFalseTotal
if ($can_expect) { } 0 0 0
2317 0 $want_expect = 1;
2318 } else {
2319 0 $CPAN::Frontend->mywarn("Expect not installed, falling back to ".
2320 "system()\n");
2321 }
2322 }
2323 4 my ($system_ok, $system_err);
2324 4 ▶ if ($want_expect) {
Branch: 2 branches
BranchTrueFalseTotal
if ($want_expect) { } 0 4 4
elsif ($self->_should_report('make')) { } 0 4 4
2325 # XXX probably want to check _should_report here and
2326 # warn about not being able to use CPAN::Reporter with expect
2327 0 $system_ok = $self->_run_via_expect($system,'make',$expect_model) == 0;
2328 }
2329 elsif ( $self->_should_report('make') ) {
2330 0 my ($output, $ret) = CPAN::Reporter::record_command($system);
2331 0 CPAN::Reporter::grade_make( $self, $system, $output, $ret );
2332 0 $system_ok = ! $ret;
2333 }
2334 else {
2335 4 my $rc = system($system);
2336 4 $system_ok = $rc == 0;
2337 4 ▶ $system_err = $! if $rc == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $rc == -1 0 4 4
2338 }
2339 4 $self->introduce_myself;
2340 4 ▶ if ( $system_ok ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($system_ok) { } 4 0 4
2341 4 $CPAN::Frontend->myprint(" $system -- OK\n");
2342 4 $self->{make} = CPAN::Distrostatus->new("YES");
2343 } else {
2344 0 ▶ $self->{writemakefile} ||= CPAN::Distrostatus->new("YES");
Condition0%0/3
$self->{"writemakefile"} ||= "CPAN::Distrostatus"->new("YES")
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"writemakefile"} ||= "CPAN::Distrostatus"->new("YES")
$self->{"writemakefile"} "CPAN::Distrostatus"->new("YES")
Truth table0%0/3
A ||= B
A= $self->{"writemakefile"}B= "CPAN::Distrostatus"->new("YES")
ABresult
1X1
011
000
2345 0 $self->{make} = CPAN::Distrostatus->new("NO");
2346 0 $CPAN::Frontend->mywarn(" $system -- NOT OK\n");
2347 0 ▶ $CPAN::Frontend->mywarn(" $system_err\n") if defined $system_err;
Branch: 1 branch
BranchTrueFalseTotal
if defined $system_err 0 0 0
2348 }
2349 4 $self->store_persistent_state;
2350  
2351 4 $self->post_make();
2352  
2353 4 return !! $system_ok;
2354 }
2355  
2356 # CPAN::Distribution::goodbye ;
2357 3 ▶sub goodbye {
Subroutine goodbye: called CC=1 SCAR=0.0
Pod undocumented
2358 3 my($self,$goodbye) = @_;
2359 3 my $id = $self->pretty_id;
2360 3 $CPAN::Frontend->mywarn(" $id\n $goodbye\n");
2361 3 return 0; # must be explicit false, not undef
2362 }
2363  
2364 4 ▶sub success {
Subroutine success: called CC=1 SCAR=0.0
Pod undocumented
2365 4 my($self,$why) = @_;
2366 4 my $id = $self->pretty_id;
2367 4 $CPAN::Frontend->myprint(" $id\n $why\n");
2368 4 return 1;
2369 }
2370  
2371 # CPAN::Distribution::_run_via_expect ;
2372 0 ▶sub _run_via_expect {
Subroutine _run_via_expect: not called CC=6 SCAR=37.4
2373 0 my($self,$system,$phase,$expect_model) = @_;
2374 0 ▶ CPAN->debug("system[$system]expect_model[$expect_model]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
2375 0 ▶ if ($CPAN::META->has_inst("Expect")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst('Expect')) { } 0 0 0
2376 0 my $expo = Expect->new; # expo Expect object;
2377 0 $expo->spawn($system);
2378 0 ▶ $expect_model->{mode} ||= "deterministic";
Condition0%0/2
$expect_model->{"mode"} ||= "deterministic"
l!l
00
MC/DC0%0/1
$expect_model->{"mode"} ||= "deterministic"
$expect_model->{"mode"}
Truth table0%0/2
A
A= $expect_model->{"mode"}
Aresult
11
00
2379 0 ▶ if ($expect_model->{mode} eq "deterministic") {
Branch: 2 branches
BranchTrueFalseTotal
if ($expect_model->{'mode'} eq 'deterministic') { } 0 0 0
elsif ($expect_model->{'mode'} eq 'anyorder') { } 0 0 0
2380 0 return $self->_run_via_expect_deterministic($expo,$phase,$expect_model);
2381 } elsif ($expect_model->{mode} eq "anyorder") {
2382 0 return $self->_run_via_expect_anyorder($expo,$phase,$expect_model);
2383 } else {
2384 0 die "Panic: Illegal expect mode: $expect_model->{mode}";
2385 }
2386 } else {
2387 0 $CPAN::Frontend->mywarn("Expect not installed, falling back to system()\n");
2388 0 return system($system);
2389 }
2390 }
2391  
2392 0 ▶sub _run_via_expect_anyorder {
Subroutine _run_via_expect_anyorder: not called CC=9 SCAR=45.0
2393 0 my($self,$expo,$phase,$expect_model) = @_;
2394 0 ▶ my $timeout = $expect_model->{timeout} || 5;
Condition0%0/2
$expect_model->{'timeout'} || 5
l!l
00
MC/DC0%0/1
$expect_model->{'timeout'} || 5
$expect_model->{'timeout'}
Truth table0%0/2
A
A= $expect_model->{'timeout'}
Aresult
11
00
2395 0 my $reuse = $expect_model->{reuse};
2396 0 my @expectacopy = @{$expect_model->{talk}}; # we trash it!
2397 0 my $but = "";
2398 0 my $timeout_start = time;
2399 0 EXPECT: while () {
2400 0 my($eof,$ran_into_timeout);
2401 # XXX not up to the full power of expect. one could certainly
2402 # wrap all of the talk pairs into a single expect call and on
2403 # success tweak it and step ahead to the next question. The
2404 # current implementation unnecessarily limits itself to a
2405 # single match.
2406 my @match = $expo->expect(1,
2407 0 ▶ [ eof => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2408 0 $eof++;
2409 } ],
2410 0 ▶ [ timeout => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2411 0 $ran_into_timeout++;
2412 0 } ],
2413 -re => eval"qr{.}",
2414 );
2415 0 ▶ if ($match[2]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($match[2]) 0 0 0
2416 0 $but .= $match[2];
2417 }
2418 0 $but .= $expo->clear_accum;
2419 0 ▶ if ($eof) {
Branch: 2 branches
BranchTrueFalseTotal
if ($eof) { } 0 0 0
elsif ($ran_into_timeout) { } 0 0 0
2420 0 $expo->soft_close;
2421 0 return $expo->exitstatus();
2422 } elsif ($ran_into_timeout) {
2423 # warn "DEBUG: they are asking a question, but[$but]";
2424 0 ▶ for (my $i = 0; $i <= $#expectacopy; $i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#expectacopy) 0 0 0
2425 0 my($next,$send) = @expectacopy[$i,$i+1];
2426 0 my $regex = eval "qr{$next}";
2427 # warn "DEBUG: will compare with regex[$regex].";
2428 0 ▶ if ($but =~ /$regex/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($but =~ /$regex/) 0 0 0
2429 # warn "DEBUG: will send send[$send]";
2430 0 $expo->send($send);
2431 # never allow reusing an QA pair unless they told us
2432 0 ▶ splice @expectacopy, $i, 2 unless $reuse;
Branch: 1 branch
BranchTrueFalseTotal
unless $reuse 0 0 0
2433 0 $but =~ s/(?s:^.*?)$regex//;
2434 0 $timeout_start = time;
2435 0 next EXPECT;
2436 }
2437 }
2438 0 my $have_waited = time - $timeout_start;
2439 0 ▶ if ($have_waited < $timeout) {
Branch: 1 branch
BranchTrueFalseTotal
if ($have_waited < $timeout) 0 0 0
2440 # warn "DEBUG: have_waited[$have_waited]timeout[$timeout]";
2441 0 next EXPECT;
2442 }
2443 0 my $why = "could not answer a question during the dialog";
2444 0 $CPAN::Frontend->mywarn("Failing: $why\n");
2445 0 $self->{$phase} =
2446 CPAN::Distrostatus->new("NO $why");
2447 0 return 0;
2448 }
2449 }
2450 }
2451  
2452 0 ▶sub _run_via_expect_deterministic {
Subroutine _run_via_expect_deterministic: not called CC=6 SCAR=37.4
2453 0 my($self,$expo,$phase,$expect_model) = @_;
2454 0 my $ran_into_timeout;
2455 my $ran_into_eof;
2456 0 ▶ my $timeout = $expect_model->{timeout} || 15; # currently unsettable
Condition0%0/2
$expect_model->{'timeout'} || 15
l!l
00
MC/DC0%0/1
$expect_model->{'timeout'} || 15
$expect_model->{'timeout'}
Truth table0%0/2
A
A= $expect_model->{'timeout'}
Aresult
11
00
2457 0 my $expecta = $expect_model->{talk};
2458 0 ▶ EXPECT: for (my $i = 0; $i <= $#$expecta; $i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $expecta->$#*) 0 0 0
2459 0 my($re,$send) = @$expecta[$i,$i+1];
2460 0 ▶ CPAN->debug("timeout[$timeout]re[$re]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
2461 0 my $regex = eval "qr{$re}";
2462 $expo->expect($timeout,
2463 0 ▶ [ eof => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2464 0 my $but = $expo->clear_accum;
2465 0 $CPAN::Frontend->mywarn("EOF (maybe harmless)
2466 expected[$regex]\nbut[$but]\n\n");
2467 0 $ran_into_eof++;
2468 } ],
2469 0 ▶ [ timeout => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2470 0 my $but = $expo->clear_accum;
2471 0 $CPAN::Frontend->mywarn("TIMEOUT
2472 expected[$regex]\nbut[$but]\n\n");
2473 0 $ran_into_timeout++;
2474 0 } ],
2475 -re => $regex);
2476 0 ▶ if ($ran_into_timeout) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ran_into_timeout) { } 0 0 0
elsif ($ran_into_eof) { } 0 0 0
2477 # note that the caller expects 0 for success
2478 0 $self->{$phase} =
2479 CPAN::Distrostatus->new("NO timeout during expect dialog");
2480 0 return 0;
2481 } elsif ($ran_into_eof) {
2482 0 last EXPECT;
2483 }
2484 0 $expo->send($send);
2485 }
2486 0 $expo->soft_close;
2487 0 return $expo->exitstatus();
2488 }
2489  
2490 #-> CPAN::Distribution::_validate_distropref
2491 0 ▶sub _validate_distropref {
Subroutine _validate_distropref: not called CC=5 SCAR=34.0
2492 0 my($self,@args) = @_;
2493 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst('CPAN::Kwalify') and $CPAN::META->has_inst('Kwalify')) { } 0 0 0
Condition0%0/3
$CPAN::META->has_inst("CPAN::Kwalify") and $CPAN::META->has_inst("Kwalify")
!ll&&!rl&&r
000
MC/DC0%0/2
$CPAN::META->has_inst("CPAN::Kwalify") and $CPAN::META->has_inst("Kwalify")
$CPAN::META->has_inst("CPAN::Kwalify") $CPAN::META->has_inst("Kwalify")
Truth table0%0/3
A and B
A= $CPAN::META->has_inst("CPAN::Kwalify")B= $CPAN::META->has_inst("Kwalify")
ABresult
0X0
100
111
2494 $CPAN::META->has_inst("CPAN::Kwalify")
2495 &&
2496 $CPAN::META->has_inst("Kwalify")
2497 ) {
2498 0 eval {CPAN::Kwalify::_validate("distroprefs",@args);};
2499 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
2500 0 $CPAN::Frontend->mywarn($@);
2501 }
2502 } else {
2503 0 ▶ CPAN->debug("not validating '@args'") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
2504 }
2505 }
2506  
2507 #-> CPAN::Distribution::_find_prefs
2508 0 ▶sub _find_prefs {
Subroutine _find_prefs: not called CC=18 SCAR=58.3
2509 0 my($self) = @_;
2510 0 my $distroid = $self->pretty_id;
2511 #CPAN->debug("distroid[$distroid]") if $CPAN::DEBUG;
2512 0 my $prefs_dir = $CPAN::Config->{prefs_dir};
2513 0 ▶ return if $prefs_dir =~ /^\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
if $prefs_dir =~ /^\s*$/ 0 0 0
2514 0 eval { File::Path::mkpath($prefs_dir); };
2515 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
2516 0 $CPAN::Frontend->mydie("Cannot create directory $prefs_dir");
2517 }
2518 # shortcut if there are no distroprefs files
2519 {
2520 0 ▶ my $dh = DirHandle->new($prefs_dir) or $CPAN::Frontend->mydie("Couldn't open '$prefs_dir': $!");
Branch: 1 branch
BranchTrueFalseTotal
my $dh = "DirHandle"->new($prefs_dir) or $CPAN::Frontend->mydie("Couldn't open '${prefs_dir}': $!") 0 0 0
2521 0 my @files = map { /\.(yml|dd|st)\z/i } $dh->read;
2522 0 ▶ return unless @files;
Branch: 1 branch
BranchTrueFalseTotal
unless @files 0 0 0
2523 }
2524 0 my $yaml_module = CPAN::_yaml_module();
2525 0 my $ext_map = {};
2526 0 my @extensions;
2527 0 ▶ if ($CPAN::META->has_inst($yaml_module)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst($yaml_module)) { } 0 0 0
2528 0 $ext_map->{yml} = 'CPAN';
2529 } else {
2530 0 my @fallbacks;
2531 0 ▶ if ($CPAN::META->has_inst("Data::Dumper")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst("Data::Dumper")) 0 0 0
2532 0 push @fallbacks, $ext_map->{dd} = 'Data::Dumper';
2533 }
2534 0 ▶ if ($CPAN::META->has_inst("Storable")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst("Storable")) 0 0 0
2535 0 push @fallbacks, $ext_map->{st} = 'Storable';
2536 }
2537 0 ▶ if (@fallbacks) {
Branch: 1 branch
BranchTrueFalseTotal
if (@fallbacks) { } 0 0 0
2538 0 local $" = " and ";
2539 0 ▶ unless ($self->{have_complained_about_missing_yaml}++) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"have_complained_about_missing_yaml"}++) 0 0 0
2540 0 $CPAN::Frontend->mywarnonce("'$yaml_module' not installed, falling back ".
2541 "to @fallbacks to read prefs '$prefs_dir'\n");
2542 }
2543 } else {
2544 0 ▶ unless ($self->{have_complained_about_missing_yaml}++) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"have_complained_about_missing_yaml"}++) 0 0 0
2545 0 $CPAN::Frontend->mywarnonce("'$yaml_module' not installed, cannot ".
2546 "read prefs '$prefs_dir'\n");
2547 }
2548 }
2549 }
2550 0 my $finder = CPAN::Distroprefs->find($prefs_dir, $ext_map);
2551 0 ▶ DIRENT: while (my $result = $finder->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $result = $finder->next) 0 0 0
2552 0 ▶ if ($result->is_warning) {
Branch: 2 branches
BranchTrueFalseTotal
if ($result->is_warning) { } 0 0 0
elsif ($result->is_fatal) { } 0 0 0
2553 0 $CPAN::Frontend->mywarn($result->as_string);
2554 0 $CPAN::Frontend->mysleep(1);
2555 0 next DIRENT;
2556 } elsif ($result->is_fatal) {
2557 0 $CPAN::Frontend->mydie($result->as_string);
2558 }
2559  
2560 0 my @prefs = @{ $result->prefs };
2561  
2562 0 ELEMENT: for my $y (0..$#prefs) {
2563 0 my $pref = $prefs[$y];
2564 0 $self->_validate_distropref($pref->data, $result->abs, $y);
2565  
2566 # I don't know why we silently skip when there's no match, but
2567 # complain if there's an empty match hashref, and there's no
2568 # comment explaining why -- hdp, 2008-03-18
2569 0 ▶ unless ($pref->has_any_match) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($pref->has_any_match) 0 0 0
2570 0 next ELEMENT;
2571 }
2572  
2573 0 ▶ unless ($pref->has_valid_subkeys) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($pref->has_valid_subkeys) 0 0 0
2574 0 $CPAN::Frontend->mydie(sprintf
2575 "Nonconforming .%s file '%s': " .
2576 "missing match/* subattribute. " .
2577 "Please remove, cannot continue.",
2578 $result->ext, $result->abs,
2579 );
2580 }
2581  
2582 my $arg = {
2583 env => \%ENV,
2584 distribution => $distroid,
2585 perl => \&CPAN::find_perl,
2586 perlconfig => \%Config::Config,
2587 0 ▶ module => sub { [ $self->containsmods ] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
2588 0 };
2589  
2590 0 ▶ if ($pref->matches($arg)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pref->matches($arg)) 0 0 0
2591 return {
2592 0 prefs => $pref->data,
2593 prefs_file => $result->abs,
2594 prefs_file_doc => $y,
2595 };
2596 }
2597  
2598 }
2599 }
2600 0 return;
2601 }
2602  
2603 # CPAN::Distribution::prefs
2604 182 ▶sub prefs {
Subroutine prefs: called CC=11 SCAR=40.2
Pod undocumented
2605 182 my($self) = @_;
2606 182 ▶ if (exists $self->{negative_prefs_cache}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"negative_prefs_cache"} and $self->{"negative_prefs_cache"} != $CPAN::CurrentCommandId) 0 182 182
Condition66%2/3
exists $self->{"negative_prefs_cache"} and $self->{"negative_prefs_cache"} != $CPAN::CurrentCommandId
!ll&&!rl&&r
71750
MC/DC0%0/2
exists $self->{"negative_prefs_cache"} and $self->{"negative_prefs_cache"} != $CPAN::CurrentCommandId
exists $self->{"negative_prefs_cache"} $self->{"negative_prefs_cache"} != $CPAN::CurrentCommandId
Truth table66%2/3
A and B
A= exists $self->{"negative_prefs_cache"}B= $self->{"negative_prefs_cache"} != $CPAN::CurrentCommandId
ABresult
0X0
100
111
2607 &&
2608 $self->{negative_prefs_cache} != $CPAN::CurrentCommandId
2609 ) {
2610 0 delete $self->{negative_prefs_cache};
2611 0 delete $self->{prefs};
2612 }
2613 182 ▶ if (exists $self->{prefs}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"prefs"}) 175 7 182
2614 175 return $self->{prefs}; # XXX comment out during debugging
2615 }
2616 7 ▶ if ($CPAN::Config->{prefs_dir}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"prefs_dir"}) 0 7 7
2617 0 ▶ CPAN->debug("prefs_dir[$CPAN::Config->{prefs_dir}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
2618 0 my $prefs = $self->_find_prefs();
2619 0 ▶ $prefs ||= ""; # avoid warning next line
Condition0%0/2
$prefs ||= ""
l!l
00
MC/DC0%0/1
$prefs ||= ""
$prefs
Truth table0%0/2
A
A= $prefs
Aresult
11
00
2620 0 ▶ CPAN->debug("prefs[$prefs]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
2621 0 ▶ if ($prefs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prefs) 0 0 0
2622 0 for my $x (qw(prefs prefs_file prefs_file_doc)) {
2623 0 $self->{$x} = $prefs->{$x};
2624 }
2625 my $bs = sprintf(
2626 "%s[%s]",
2627 File::Basename::basename($self->{prefs_file}),
2628 $self->{prefs_file_doc},
2629 0 );
2630 0 my $filler1 = "_" x 22;
2631 0 my $filler2 = int(66 - length($bs))/2;
2632 0 ▶ $filler2 = 0 if $filler2 < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $filler2 < 0 0 0 0
2633 0 $filler2 = " " x $filler2;
2634 0 my $pretty = $self->pretty_id;
2635 0 my $filler3 = int(66 - length($pretty))/2;
2636 0 $filler3 = " " x $filler3;
2637 0 $CPAN::Frontend->myprint("
2638 $filler1 D i s t r o P r e f s $filler1
2639 $filler2 $bs $filler2
2640 $filler3 $pretty $filler3
2641 ");
2642 0 $CPAN::Frontend->mysleep(1);
2643 0 return $self->{prefs};
2644 }
2645 }
2646 7 $self->{negative_prefs_cache} = $CPAN::CurrentCommandId;
2647 7 return $self->{prefs} = +{};
2648 }
2649  
2650 # CPAN::Distribution::_make_phase_arg
2651 15 ▶sub _make_phase_arg {
Subroutine _make_phase_arg: called CC=7 SCAR=23.3
2652 15 my($self, $phase) = @_;
2653 15 my $_make_phase_arg;
2654 15 my $prefs = $self->prefs;
2655 15 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($prefs and exists $prefs->{$phase} and exists $prefs->{$phase}{"args"} and $prefs->{$phase}{"args"}) 0 15 15
Condition33%3/9
$prefs and exists $prefs->{$phase} and exists $prefs->{$phase}{"args"} and $prefs->{$phase}{"args"}
!ll&&!rl&&r
1500
$prefs and exists $prefs->{$phase} and exists $prefs->{$phase}{"args"}
!ll&&!rl&&r
1500
$prefs and exists $prefs->{$phase}
!ll&&!rl&&r
0150
MC/DC0%0/4
$prefs and exists $prefs->{$phase} and exists $prefs->{$phase}{"args"} and $prefs->{$phase}{"args"}
$prefs exists $prefs->{$phase} exists $prefs->{$phase}{"args"} $prefs->{$phase}{"args"}
Truth table20%1/5
A and B and C and D
A= $prefsB= exists $prefs->{$phase}C= exists $prefs->{$phase}{"args"}D= $prefs->{$phase}{"args"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
2656 $prefs
2657 && exists $prefs->{$phase}
2658 && exists $prefs->{$phase}{args}
2659 && $prefs->{$phase}{args}
2660 ) {
2661 $_make_phase_arg = join(" ",
2662 0 map {CPAN::HandleConfig
2663 0 ->safe_quote($_)} @{$prefs->{$phase}{args}},
2664 );
2665 }
2666  
2667 # cpan[2]> o conf make[TAB]
2668 # make make_install_make_command
2669 # make_arg makepl_arg
2670 # make_install_arg
2671 # cpan[2]> o conf mbuild[TAB]
2672 # mbuild_arg mbuild_install_build_command
2673 # mbuild_install_arg mbuildpl_arg
2674  
2675 15 my $mantra; # must switch make/mbuild here
2676 15 ▶ if ($self->{modulebuild}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'modulebuild'}) { } 0 15 15
2677 0 $mantra = "mbuild";
2678 } else {
2679 15 $mantra = "make";
2680 }
2681 15 my %map = (
2682 pl => "pl_arg",
2683 make => "_arg",
2684 test => "_test_arg", # does not really exist but maybe
2685 # will some day and now protects
2686 # us from unini warnings
2687 install => "_install_arg",
2688 );
2689 15 my $phase_underscore_meshup = $map{$phase};
2690 15 my $what = sprintf "%s%s", $mantra, $phase_underscore_meshup;
2691  
2692 15 ▶ $_make_phase_arg ||= $CPAN::Config->{$what};
Condition66%2/3
$_make_phase_arg ||= $CPAN::Config->{$what}
l!l&&r!l&&!r
078
MC/DC50%1/2
$_make_phase_arg ||= $CPAN::Config->{$what}
$_make_phase_arg $CPAN::Config->{$what}
Truth table66%2/3
A ||= B
A= $_make_phase_argB= $CPAN::Config->{$what}
ABresult
1X1
011
000
2693 15 return $_make_phase_arg;
2694 }
2695  
2696 # CPAN::Distribution::_make_command
2697 9 ▶sub _make_command {
Subroutine _make_command: called CC=7 SCAR=31.7
2698 9 my ($self) = @_;
2699 9 ▶ if ($self) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self) { } 9 0 9
2700 return
2701 CPAN::HandleConfig
2702 ->safe_quote(
2703 CPAN::HandleConfig->prefs_lookup($self,
2704 q{make})
2705 || $Config::Config{make}
2706 9 ▶ || 'make'
Condition40%2/5
'CPAN::HandleConfig'->prefs_lookup($self, 'make') || $Config::Config{'make'} || 'make'
l!l
90
"CPAN::HandleConfig"->prefs_lookup($self, "make") or $Config::Config{"make"}
l!l&&r!l&&!r
090
MC/DC0%0/2
'CPAN::HandleConfig'->prefs_lookup($self, 'make') || $Config::Config{'make'} || 'make'
"CPAN::HandleConfig"->prefs_lookup($self, "make") $Config::Config{"make"}
Truth table33%1/3
A or B
A= "CPAN::HandleConfig"->prefs_lookup($self, "make")B= $Config::Config{"make"}
ABresult
1X1
011
000
2707 );
2708 } else {
2709 # Old style call, without object. Deprecated
2710 0 Carp::confess("CPAN::_make_command() used as function. Don't Do That.");
2711 return
2712 safe_quote(undef,
2713 CPAN::HandleConfig->prefs_lookup($self,q{make})
2714 || $CPAN::Config->{make}
2715 || $Config::Config{make}
2716 0 ▶ || 'make');
Condition0%0/8
'CPAN::HandleConfig'->prefs_lookup($self, 'make') || $CPAN::Config->{'make'} || $Config::Config{'make'} || 'make'
l!l
00
"CPAN::HandleConfig"->prefs_lookup($self, "make") or $CPAN::Config->{"make"} or $Config::Config{"make"}
l!l&&r!l&&!r
000
"CPAN::HandleConfig"->prefs_lookup($self, "make") or $CPAN::Config->{"make"}
l!l&&r!l&&!r
000
MC/DC0%0/3
'CPAN::HandleConfig'->prefs_lookup($self, 'make') || $CPAN::Config->{'make'} || $Config::Config{'make'} || 'make'
"CPAN::HandleConfig"->prefs_lookup($self, "make") $CPAN::Config->{"make"} $Config::Config{"make"}
Truth table0%0/4
A or B or C
A= "CPAN::HandleConfig"->prefs_lookup($self, "make")B= $CPAN::Config->{"make"}C= $Config::Config{"make"}
ABCresult
1XX1
01X1
0011
0000
2717 }
2718 }
2719  
2720 1 ▶sub _make_install_make_command {
Subroutine _make_install_make_command: called CC=3 SCAR=15.1
2721 1 my ($self) = @_;
2722 1 my $mimc =
2723 CPAN::HandleConfig->prefs_lookup($self, q{make_install_make_command});
2724 1 ▶ return $self->_make_command() unless $mimc;
Branch: 1 branch
BranchTrueFalseTotal
unless $mimc 1 0 1
2725  
2726 # Quote the "make install" make command on Windows, where it is commonly
2727 # found in, e.g., C:\Program Files\... and therefore needs quoting. We can't
2728 # do this in general because the command maybe "sudo make..." (i.e. a
2729 # program with arguments), but that is unlikely to be the case on Windows.
2730 0 ▶ $mimc = CPAN::HandleConfig->safe_quote($mimc) if $^O eq 'MSWin32';
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "MSWin32" 0 0 0
2731  
2732 0 return $mimc;
2733 }
2734  
2735 #-> sub CPAN::Distribution::is_locally_optional
2736 0 ▶sub is_locally_optional {
Subroutine is_locally_optional: not called CC=9 SCAR=45.0
Pod undocumented
2737 0 my($self, $prereq_pm, $prereq) = @_;
2738 0 ▶ $prereq_pm ||= $self->{prereq_pm};
Condition0%0/3
$prereq_pm ||= $self->{"prereq_pm"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$prereq_pm ||= $self->{"prereq_pm"}
$prereq_pm $self->{"prereq_pm"}
Truth table0%0/3
A ||= B
A= $prereq_pmB= $self->{"prereq_pm"}
ABresult
1X1
011
000
2739 0 my($nmo,$opt);
2740 0 for my $rt (qw(requires build_requires)) {
2741 0 ▶ if (exists $prereq_pm->{$rt}{$prereq}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $prereq_pm->{$rt}{$prereq}) 0 0 0
2742 # rt 121914
2743 0 ▶ $nmo ||= $CPAN::META->instance("CPAN::Module",$prereq);
Condition0%0/3
$nmo ||= $CPAN::META->instance("CPAN::Module", $prereq)
l!l&&r!l&&!r
000
MC/DC0%0/2
$nmo ||= $CPAN::META->instance("CPAN::Module", $prereq)
$nmo $CPAN::META->instance("CPAN::Module", $prereq)
Truth table0%0/3
A ||= B
A= $nmoB= $CPAN::META->instance("CPAN::Module", $prereq)
ABresult
1X1
011
000
2744 0 my $av = $nmo->available_version;
2745 0 ▶ return 0 if !$av || CPAN::Version->vlt($av,$prereq_pm->{$rt}{$prereq});
Branch: 1 branch
BranchTrueFalseTotal
if not $av or "CPAN::Version"->vlt($av, $prereq_pm->{$rt}{$prereq}) 0 0 0
Condition0%0/3
not $av or "CPAN::Version"->vlt($av, $prereq_pm->{$rt}{$prereq})
l!l&&r!l&&!r
000
MC/DC0%0/2
not $av or "CPAN::Version"->vlt($av, $prereq_pm->{$rt}{$prereq})
not $av "CPAN::Version"->vlt($av, $prereq_pm->{$rt}{$prereq})
Truth table0%0/3
not(A) or B
A= not $avB= "CPAN::Version"->vlt($av, $prereq_pm->{$rt}{$prereq})
ABresult
1X1
011
000
2746 }
2747 0 ▶ if (exists $prereq_pm->{"opt_$rt"}{$prereq}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $$prereq_pm{"opt_$rt"}{$prereq}) 0 0 0
2748 0 $opt = 1;
2749 }
2750 }
2751 0 ▶ return $opt||0;
Condition0%0/2
$opt || 0
l!l
00
MC/DC0%0/1
$opt || 0
$opt
Truth table0%0/2
A
A= $opt
Aresult
11
00
2752 }
2753  
2754 #-> sub CPAN::Distribution::follow_prereqs ;
2755 0 ▶sub follow_prereqs {
Subroutine follow_prereqs: not called CC=18 SCAR=58.3
Pod undocumented
2756 0 my($self) = shift;
2757 0 my($slot) = shift;
2758 0 my(@prereq_tuples) = grep {$_->[0] ne "perl"} @_;
2759 0 ▶ return unless @prereq_tuples;
Branch: 1 branch
BranchTrueFalseTotal
unless @prereq_tuples 0 0 0
2760 0 my(@good_prereq_tuples);
2761 0 for my $p (@prereq_tuples) {
2762 # e.g. $p = ['Devel::PartialDump', 'r', 1]
2763 # promote if possible
2764 0 ▶ if ($p->[1] =~ /^(r|c)$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($p->[1] =~ /^(r|c)$/) { } 0 0 0
elsif ($p->[1] =~ /^(b)$/) { } 0 0 0
2765 0 push @good_prereq_tuples, $p;
2766 } elsif ($p->[1] =~ /^(b)$/) {
2767 0 my $reqtype = CPAN::Queue->reqtype_of($p->[0]);
2768 0 ▶ if ($reqtype =~ /^(r|c)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($reqtype =~ /^(r|c)$/) { } 0 0 0
2769 0 push @good_prereq_tuples, [$p->[0], $reqtype, $p->[2]];
2770 } else {
2771 0 push @good_prereq_tuples, $p;
2772 }
2773 } else {
2774 0 die "Panic: in follow_prereqs: reqtype[$p->[1]] seen, should never happen";
2775 }
2776 }
2777 0 my $pretty_id = $self->pretty_id;
2778 0 my %map = (
2779 b => "build_requires",
2780 r => "requires",
2781 c => "commandline",
2782 );
2783 0 my($filler1,$filler2,$filler3,$filler4);
2784 0 my $unsat = "Unsatisfied dependencies detected during";
2785 0 ▶ my $w = length($unsat) > length($pretty_id) ? length($unsat) : length($pretty_id);
Branch: 1 branch
BranchTrueFalseTotal
length $unsat > length $pretty_id ? : 0 0 0
2786 {
2787 0 my $r = int(($w - length($unsat))/2);
2788 0 my $l = $w - length($unsat) - $r;
2789 0 $filler1 = "-"x4 . " "x$l;
2790 0 $filler2 = " "x$r . "-"x4 . "\n";
2791 }
2792 {
2793 0 my $r = int(($w - length($pretty_id))/2);
2794 0 my $l = $w - length($pretty_id) - $r;
2795 0 $filler3 = "-"x4 . " "x$l;
2796 0 $filler4 = " "x$r . "-"x4 . "\n";
2797 }
2798 $CPAN::Frontend->
2799 myprint("$filler1 $unsat $filler2".
2800 "$filler3 $pretty_id $filler4".
2801 0 ▶ join("", map {sprintf " %s \[%s%s]\n", $_->[0], $map{$_->[1]}, $self->is_locally_optional(undef,$_->[0]) ? ",optional" : ""} @good_prereq_tuples),
Branch: 1 branch
BranchTrueFalseTotal
$self->is_locally_optional(undef, $_->[0]) ? : 0 0 0
2802 );
2803 0 my $follow = 0;
2804 0 ▶ if ($CPAN::Config->{prerequisites_policy} eq "follow") {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Config->{'prerequisites_policy'} eq 'follow') { } 0 0 0
elsif ($CPAN::Config->{'prerequisites_policy'} eq 'ask') { } 0 0 0
2805 0 $follow = 1;
2806 } elsif ($CPAN::Config->{prerequisites_policy} eq "ask") {
2807 0 my $answer = CPAN::Shell::colorable_makemaker_prompt(
2808 "Shall I follow them and prepend them to the queue
2809 of modules we are processing right now?", "yes");
2810 0 $follow = $answer =~ /^\s*y/i;
2811 } else {
2812 0 my @prereq = map { $_->[0] } @good_prereq_tuples;
2813 0 local($") = ", ";
2814 0 $CPAN::Frontend->
2815 myprint(" Ignoring dependencies on modules @prereq\n");
2816 }
2817 0 ▶ if ($follow) {
Branch: 1 branch
BranchTrueFalseTotal
if ($follow) 0 0 0
2818 0 my $id = $self->id;
2819 0 my(@to_queue_mand,@to_queue_opt);
2820 0 for my $gp (@good_prereq_tuples) {
2821 0 my($prereq,$reqtype,$optional) = @$gp;
2822 0 my $qthing = +{qmod=>$prereq,reqtype=>$reqtype,optional=>$optional};
2823 0 ▶ if ($optional &&
Branch: 1 branch
BranchTrueFalseTotal
if ($optional and $self->is_locally_optional(undef, $prereq)) { } 0 0 0
Condition0%0/3
$optional and $self->is_locally_optional(undef, $prereq)
!ll&&!rl&&r
000
MC/DC0%0/2
$optional and $self->is_locally_optional(undef, $prereq)
$optional $self->is_locally_optional(undef, $prereq)
Truth table0%0/3
A and B
A= $optionalB= $self->is_locally_optional(undef, $prereq)
ABresult
0X0
100
111
2824 $self->is_locally_optional(undef,$prereq)
2825 ){
2826 # Since we do not depend on this one, we do not need
2827 # this in a mandatory arrangement:
2828 0 push @to_queue_opt, $qthing;
2829 } else {
2830 0 my $any = CPAN::Shell->expandany($prereq);
2831 0 $self->{$slot . "_for"}{$any->id}++;
2832 0 ▶ if ($any) {
Branch: 1 branch
BranchTrueFalseTotal
if ($any) { } 0 0 0
2833 0 ▶ unless ($optional) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($optional) 0 0 0
2834 # No recursion check in an optional area of the tree
2835 0 $any->color_cmd_tmps(0,2);
2836 }
2837 } else {
2838 0 $CPAN::Frontend->mywarn("Warning (maybe a bug): Cannot expand prereq '$prereq'\n");
2839 0 $CPAN::Frontend->mysleep(2);
2840 }
2841 # order everything that is not locally_optional just
2842 # like mandatory items: this keeps leaves before
2843 # branches
2844 0 unshift @to_queue_mand, $qthing;
2845 }
2846 }
2847 0 ▶ if (@to_queue_mand) {
Branch: 2 branches
BranchTrueFalseTotal
if (@to_queue_mand) { } 0 0 0
elsif (@to_queue_opt) { } 0 0 0
2848 0 unshift @to_queue_mand, {qmod => $id, reqtype => $self->{reqtype}, optional=> !$self->{mandatory}};
2849 0 CPAN::Queue->jumpqueue(@to_queue_opt,@to_queue_mand);
2850 0 $self->{$slot} = "Delayed until after prerequisites";
2851 0 return 1; # signal we need dependencies
2852 } elsif (@to_queue_opt) {
2853 0 CPAN::Queue->jumpqueue(@to_queue_opt);
2854 }
2855 }
2856 0 return;
2857 }
2858  
2859 11 ▶sub _feature_depends {
Subroutine _feature_depends: called CC=12 SCAR=47.6
2860 11 my($self) = @_;
2861 11 my $meta_yml = $self->parse_meta_yml();
2862 11 ▶ my $optf = $meta_yml->{optional_features} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $optf = $meta_yml->{"optional_features"} or return 0 11 11
2863 0 ▶ if (!ref $optf or ref $optf ne "HASH"){
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $optf or ref $optf ne "HASH") 0 0 0
Condition0%0/3
not ref $optf or ref $optf ne "HASH"
l!l&&r!l&&!r
000
MC/DC0%0/2
not ref $optf or ref $optf ne "HASH"
not ref $optf ref $optf ne "HASH"
Truth table0%0/3
not(A) or B
A= not ref $optfB= ref $optf ne "HASH"
ABresult
1X1
011
000
2864 0 $CPAN::Frontend->mywarn("The content of optional_features is not a HASH reference. Cannot use it.\n");
2865 0 $optf = {};
2866 }
2867 0 ▶ my $wantf = $self->prefs->{features} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $wantf = $self->prefs->{"features"} or return 0 0 0
2868 0 ▶ if (!ref $wantf or ref $wantf ne "ARRAY"){
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $wantf or ref $wantf ne "ARRAY") 0 0 0
Condition0%0/3
not ref $wantf or ref $wantf ne "ARRAY"
l!l&&r!l&&!r
000
MC/DC0%0/2
not ref $wantf or ref $wantf ne "ARRAY"
not ref $wantf ref $wantf ne "ARRAY"
Truth table0%0/3
not(A) or B
A= not ref $wantfB= ref $wantf ne "ARRAY"
ABresult
1X1
011
000
2869 0 $CPAN::Frontend->mywarn("The content of 'features' is not an ARRAY reference. Cannot use it.\n");
2870 0 $wantf = [];
2871 }
2872 0 my $dep = +{};
2873 0 for my $wf (@$wantf) {
2874 0 ▶ if (my $f = $optf->{$wf}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $f = $optf->{$wf}) { } 0 0 0
2875 $CPAN::Frontend->myprint("Found the demanded feature '$wf' that ".
2876 "is accompanied by this description:\n".
2877 $f->{description}.
2878 0 "\n\n"
2879 );
2880 # configure_requires currently not in the spec, unlikely to be useful anyway
2881 0 for my $reqtype (qw(configure_requires build_requires requires)) {
2882 0 ▶ my $reqhash = $f->{$reqtype} or next;
Branch: 1 branch
BranchTrueFalseTotal
my $reqhash = $f->{$reqtype} or next 0 0 0
2883 0 ▶ while (my($k,$v) = each %$reqhash) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$reqhash) 0 0 0
2884 0 $dep->{$reqtype}{$k} = $v;
2885 }
2886 }
2887 } else {
2888 0 $CPAN::Frontend->mywarn("The demanded feature '$wf' was not ".
2889 "found in the META.yml file".
2890 "\n\n"
2891 );
2892 }
2893 }
2894 0 $dep;
2895 }
2896  
2897 11 ▶sub prereqs_for_slot {
Subroutine prereqs_for_slot: called CC=20 SCAR=43.7
Pod undocumented
2898 11 my($self,$slot) = @_;
2899 11 my($prereq_pm);
2900 11 ▶ unless ($CPAN::META->has_usable("CPAN::Meta::Requirements")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_usable("CPAN::Meta::Requirements")) 0 11 11
2901 0 my $whynot = "not available";
2902 0 ▶ if (defined $CPAN::Meta::Requirements::VERSION) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $CPAN::Meta::Requirements::VERSION) 0 0 0
2903 0 $whynot = "version $CPAN::Meta::Requirements::VERSION not sufficient";
2904 }
2905 0 $CPAN::Frontend->mywarn("CPAN::Meta::Requirements $whynot\n");
2906 0 my $before = "";
2907 0 ▶ if ($self->{CALLED_FOR}){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"CALLED_FOR"}) 0 0 0
2908 0 ▶ if ($self->{CALLED_FOR} =~
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"CALLED_FOR"} =~ /^( CPAN::Meta::Requirements |CPAN::DistnameInfo |version |parent |ExtUtils::MakeMaker |Test::Harness )$/x) 0 0 0
2909 /^(
2910 CPAN::Meta::Requirements
2911 |CPAN::DistnameInfo
2912 |version
2913 |parent
2914 |ExtUtils::MakeMaker
2915 |Test::Harness
2916 )$/x) {
2917 0 $CPAN::Frontend->mywarn("Please install CPAN::Meta::Requirements ".
2918 "as soon as possible; it is needed for a reliable operation of ".
2919 "the cpan shell; setting requirements to nil for '$1' for now ".
2920 "to prevent deadlock during bootstrapping\n");
2921 0 return;
2922 }
2923 0 $before = " before $self->{CALLED_FOR}";
2924 }
2925 0 $CPAN::Frontend->mydie("Please install CPAN::Meta::Requirements manually$before");
2926 }
2927 11 my $merged = CPAN::Meta::Requirements->new;
2928 11 ▶ my $prefs_depends = $self->prefs->{depends}||{};
Condition50%1/2
$self->prefs->{'depends'} || {}
l!l
011
MC/DC0%0/1
$self->prefs->{'depends'} || {}
$self->prefs->{'depends'}
Truth table50%1/2
A
A= $self->prefs->{'depends'}
Aresult
11
00
2929 11 my $feature_depends = $self->_feature_depends();
2930 11 ▶ if ($slot eq "configure_requires_later") {
Branch: 2 branches
BranchTrueFalseTotal
if ($slot eq 'configure_requires_later') { } 7 4 11
elsif ($slot eq 'later') { } 4 0 4
2931 7 for my $hash ( $self->configure_requires,
2932 $prefs_depends->{configure_requires},
2933 $feature_depends->{configure_requires},
2934 ) {
2935 14 $merged->add_requirements(
2936 CPAN::Meta::Requirements->from_string_hash($hash)
2937 );
2938 }
2939 7 ▶ if (-f "Build.PL"
Branch: 1 branch
BranchTrueFalseTotal
if (-f "Build.PL" and not -f "File::Spec"->catfile($self->{"build_dir"}, "Makefile.PL") and not @{[$merged->required_modules];} and not $CPAN::META->has_inst("Module::Build")) 0 7 7
Condition33%3/9
-f "Build.PL" and not -f "File::Spec"->catfile($self->{"build_dir"}, "Makefile.PL") and not @{[$merged->required_modules];} and not $CPAN::META->has_inst("Module::Build")
!ll&&!rl&&r
700
-f "Build.PL" and not -f "File::Spec"->catfile($self->{"build_dir"}, "Makefile.PL") and not @{[$merged->required_modules];}
!ll&&!rl&&r
700
-f "Build.PL" and not -f "File::Spec"->catfile($self->{"build_dir"}, "Makefile.PL")
!ll&&!rl&&r
700
MC/DC0%0/4
-f "Build.PL" and not -f "File::Spec"->catfile($self->{"build_dir"}, "Makefile.PL") and not @{[$merged->required_modules];} and not $CPAN::META->has_inst("Module::Build")
-f "Build.PL" not -f "File::Spec"->catfile($self->{"build_dir"}, "Makefile.PL") not @{[$merged->required_modules];} not $CPAN::META->has_inst("Module::Build")
Truth table20%1/5
A and not(B) and not(C) and not(D)
A= -f "Build.PL"B= not -f "File::Spec"->catfile($self->{"build_dir"}, "Makefile.PL")C= not @{[$merged->required_modules];}D= not $CPAN::META->has_inst("Module::Build")
ABCDresult
0XXX0
10XX0
110X0
11100
11111
2940 && ! -f File::Spec->catfile($self->{build_dir},"Makefile.PL")
2941 0 && ! @{[ $merged->required_modules ]}
2942 && ! $CPAN::META->has_inst("Module::Build")
2943 ) {
2944 0 $CPAN::Frontend->mywarn(
2945 " Warning: CPAN.pm discovered Module::Build as undeclared prerequisite.\n".
2946 " Adding it now as such.\n"
2947 );
2948 0 $CPAN::Frontend->mysleep(5);
2949 0 $merged->add_minimum( "Module::Build" => 0 );
2950 0 delete $self->{writemakefile};
2951 }
2952 7 $prereq_pm = {}; # configure_requires defined as "b"
2953 } elsif ($slot eq "later") {
2954 4 ▶ my $prereq_pm_0 = $self->prereq_pm || {};
Condition50%1/2
$self->prereq_pm || {}
l!l
40
MC/DC0%0/1
$self->prereq_pm || {}
$self->prereq_pm
Truth table50%1/2
A
A= $self->prereq_pm
Aresult
11
00
2955 4 for my $reqtype (qw(requires build_requires opt_requires opt_build_requires)) {
2956 16 ▶ $prereq_pm->{$reqtype} = {%{$prereq_pm_0->{$reqtype}||{}}}; # copy to not pollute it
Condition50%1/2
$prereq_pm_0->{$reqtype} || {}
l!l
160
MC/DC0%0/1
$prereq_pm_0->{$reqtype} || {}
$prereq_pm_0->{$reqtype}
Truth table50%1/2
A
A= $prereq_pm_0->{$reqtype}
Aresult
11
00
2957 16 for my $dep ($prefs_depends,$feature_depends) {
2958 32 ▶ for my $k (keys %{$dep->{$reqtype}||{}}) {
Condition50%1/2
$dep->{$reqtype} || {}
l!l
032
MC/DC0%0/1
$dep->{$reqtype} || {}
$dep->{$reqtype}
Truth table50%1/2
A
A= $dep->{$reqtype}
Aresult
11
00
2959 0 $prereq_pm->{$reqtype}{$k} = $dep->{$reqtype}{$k};
2960 }
2961 }
2962 }
2963 # XXX what about optional_req|breq? -- xdg, 2012-04-01
2964 4 for my $hash (
2965 $prereq_pm->{requires},
2966 $prereq_pm->{build_requires},
2967 $prereq_pm->{opt_requires},
2968 $prereq_pm->{opt_build_requires},
2969  
2970 ) {
2971 16 $merged->add_requirements(
2972 CPAN::Meta::Requirements->from_string_hash($hash)
2973 );
2974 }
2975 } else {
2976 0 die "Panic: illegal slot '$slot'";
2977 }
2978 11 return ($merged->as_string_hash, $prereq_pm);
2979 }
2980  
2981 #-> sub CPAN::Distribution::unsat_prereq ;
2982 # return ([Foo,"r"],[Bar,"b"]) for normal modules
2983 # return ([perl=>5.008]) if we need a newer perl than we are running under
2984 # (sorry for the inconsistency, it was an accident)
2985 11 ▶sub unsat_prereq {
Subroutine unsat_prereq: called CC=54 SCAR=74.7
Pod undocumented
2986 11 my($self,$slot) = @_;
2987 11 my($merged_hash,$prereq_pm) = $self->prereqs_for_slot($slot);
2988 11 my(@need);
2989 11 ▶ unless ($CPAN::META->has_usable("CPAN::Meta::Requirements")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_usable("CPAN::Meta::Requirements")) 0 11 11
2990 0 $CPAN::Frontend->mywarn("CPAN::Meta::Requirements not available, please install as soon as possible, trying to continue with severly limited capabilities\n");
2991 0 return;
2992 }
2993 11 my $merged = CPAN::Meta::Requirements->from_string_hash($merged_hash);
2994 11 my @merged = sort $merged->required_modules;
2995 11 ▶ CPAN->debug("all merged_prereqs[@merged]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 11 11
2996 11 NEED: for my $need_module ( @merged ) {
2997 8 my $need_version = $merged->requirements_for_module($need_module);
2998 8 my($available_version,$inst_file,$available_file,$nmo);
2999 8 ▶ if ($need_module eq "perl") {
Branch: 1 branch
BranchTrueFalseTotal
if ($need_module eq 'perl') { } 0 8 8
3000 0 $available_version = $];
3001 0 $available_file = CPAN::find_perl();
3002 } else {
3003 8 ▶ if (CPAN::_sqlite_running()) {
Branch: 1 branch
BranchTrueFalseTotal
if (CPAN::_sqlite_running()) 0 8 8
3004 0 CPAN::Index->reload;
3005 0 $CPAN::SQLite->search("CPAN::Module",$need_module);
3006 }
3007 8 $nmo = $CPAN::META->instance("CPAN::Module",$need_module);
3008 8 ▶ $inst_file = $nmo->inst_file || '';
Condition50%1/2
$nmo->inst_file || ''
l!l
80
MC/DC0%0/1
$nmo->inst_file || ''
$nmo->inst_file
Truth table50%1/2
A
A= $nmo->inst_file
Aresult
11
00
3009 8 ▶ $available_file = $nmo->available_file || '';
Condition50%1/2
$nmo->available_file || ''
l!l
80
MC/DC0%0/1
$nmo->available_file || ''
$nmo->available_file
Truth table50%1/2
A
A= $nmo->available_file
Aresult
11
00
3010 8 $available_version = $nmo->available_version;
3011 8 ▶ if ($nmo->uptodate) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nmo->uptodate) 8 0 8
3012 8 my $accepts = eval {
3013 8 $merged->accepts_module($need_module, $available_version);
3014 };
3015 8 ▶ unless ($accepts) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($accepts) 0 8 8
3016 0 my $rq = $merged->requirements_for_module( $need_module );
3017 0 $CPAN::Frontend->mywarn(
3018 "Warning: Version '$available_version' of ".
3019 "'$need_module' is up to date but does not ".
3020 "fulfill requirements ($rq). I will continue, ".
3021 "but chances to succeed are low.\n");
3022 }
3023 8 next NEED;
3024 }
3025  
3026 # if they have not specified a version, we accept any
3027 # installed one; in that case inst_file is always
3028 # sufficient and available_file is sufficient on
3029 # both build_requires and configure_requires
3030 my $sufficient = $inst_file ||
3031 0 ▶ ( exists $prereq_pm->{requires}{$need_module} ? 0 : $available_file );
Branch: 1 branch
BranchTrueFalseTotal
exists $prereq_pm->{'requires'}{$need_module} ? : 0 0 0
Condition0%0/3
$inst_file || (exists $prereq_pm->{'requires'}{$need_module} ? 0 : $available_file)
l!l&&r!l&&!r
000
MC/DC0%0/2
$inst_file || (exists $prereq_pm->{'requires'}{$need_module} ? 0 : $available_file)
$inst_file (exists $prereq_pm->{'requires'}{$need_module} ? 0 : $available_file)
Truth table0%0/3
A || B
A= $inst_fileB= (exists $prereq_pm->{'requires'}{$need_module} ? 0 : $available_file)
ABresult
1X1
011
000
3032 0 ▶ if ( $sufficient
Branch: 1 branch
BranchTrueFalseTotal
if ($sufficient and !defined($need_version) || $need_version eq 0 || $need_version eq "undef") 0 0 0
Condition0%0/9
$sufficient and !defined($need_version) || $need_version eq 0 || $need_version eq "undef"
!ll&&!rl&&r
000
not defined $need_version or $need_version eq 0 or $need_version eq "undef"
l!l&&r!l&&!r
000
not defined $need_version or $need_version eq 0
l!l&&r!l&&!r
000
MC/DC0%0/4
$sufficient and !defined($need_version) || $need_version eq 0 || $need_version eq "undef"
$sufficient not defined $need_version $need_version eq 0 $need_version eq "undef"
Truth table0%0/5
A and not(B) or C or D
A= $sufficientB= not defined $need_versionC= $need_version eq 0D= $need_version eq "undef"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
3033 and ( # a few quick short circuits
3034 not defined $need_version
3035 or $need_version eq '0' # "==" would trigger warning when not numeric
3036 or $need_version eq "undef"
3037 )) {
3038 0 ▶ unless ($nmo->inst_deprecated) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($nmo->inst_deprecated) 0 0 0
3039 0 next NEED;
3040 }
3041 }
3042 }
3043  
3044 # We only want to install prereqs if either they're not installed
3045 # or if the installed version is too old. We cannot omit this
3046 # check, because if 'force' is in effect, nobody else will check.
3047 # But we don't want to accept a deprecated module installed as part
3048 # of the Perl core, so we continue if the available file is the installed
3049 # one and is deprecated
3050  
3051 0 ▶ if ( $available_file ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($available_file) 0 0 0
3052 0 my $fulfills_all_version_rqs = $self->_fulfills_all_version_rqs
3053 (
3054 $need_module,
3055 $available_file,
3056 $available_version,
3057 $need_version,
3058 );
3059 0 ▶ if ( $inst_file
Branch: 2 branches
BranchTrueFalseTotal
if ($inst_file and $available_file eq $inst_file and $nmo->inst_deprecated) { } 0 0 0
elsif ($self->{'reqtype'} and $self->{'reqtype'} =~ /^(r|c)$/ and exists $prereq_pm->{'requires'}{$need_module} || exists $prereq_pm->{'opt_requires'}{$need_module} and $nmo and not $inst_file) { } 0 0 0
Condition0%0/6
$inst_file and $available_file eq $inst_file and $nmo->inst_deprecated
!ll&&!rl&&r
000
$inst_file and $available_file eq $inst_file
!ll&&!rl&&r
000
MC/DC0%0/3
$inst_file and $available_file eq $inst_file and $nmo->inst_deprecated
$inst_file $available_file eq $inst_file $nmo->inst_deprecated
Truth table0%0/4
A and B and C
A= $inst_fileB= $available_file eq $inst_fileC= $nmo->inst_deprecated
ABCresult
0XX0
10X0
1100
1111
3060 && $available_file eq $inst_file
3061 && $nmo->inst_deprecated
3062 ) {
3063 # continue installing as a prereq. we really want that
3064 # because the deprecated module may spit out warnings
3065 # and third party did not know until today. Only one
3066 # exception is OK, because CPANPLUS is special after
3067 # all:
3068 0 ▶ if ( $fulfills_all_version_rqs and
Branch: 1 branch
BranchTrueFalseTotal
if ($fulfills_all_version_rqs and $nmo->id =~ /^CPANPLUS(?:::Dist::Build)$/) 0 0 0
Condition0%0/3
$fulfills_all_version_rqs and $nmo->id =~ /^CPANPLUS(?:::Dist::Build)$/
!ll&&!rl&&r
000
MC/DC0%0/2
$fulfills_all_version_rqs and $nmo->id =~ /^CPANPLUS(?:::Dist::Build)$/
$fulfills_all_version_rqs $nmo->id =~ /^CPANPLUS(?:::Dist::Build)$/
Truth table0%0/3
A and B
A= $fulfills_all_version_rqsB= $nmo->id =~ /^CPANPLUS(?:::Dist::Build)$/
ABresult
0X0
100
111
3069 $nmo->id =~ /^CPANPLUS(?:::Dist::Build)$/
3070 ) {
3071 # here we have an available version that is good
3072 # enough although deprecated (preventing circular
3073 # loop CPANPLUS => CPANPLUS::Dist::Build RT#83042)
3074 0 next NEED;
3075 }
3076 ▶ } elsif (
Condition0%0/15
$self->{"reqtype"} and $self->{"reqtype"} =~ /^(r|c)$/ and exists $prereq_pm->{"requires"}{$need_module} || exists $prereq_pm->{"opt_requires"}{$need_module} and $nmo and not $inst_file
!ll&&!rl&&r
000
$self->{"reqtype"} and $self->{"reqtype"} =~ /^(r|c)$/ and exists $prereq_pm->{"requires"}{$need_module} || exists $prereq_pm->{"opt_requires"}{$need_module} and $nmo
!ll&&!rl&&r
000
$self->{"reqtype"} and $self->{"reqtype"} =~ /^(r|c)$/ and exists $prereq_pm->{"requires"}{$need_module} || exists $prereq_pm->{"opt_requires"}{$need_module}
!ll&&!rl&&r
000
$self->{"reqtype"} and $self->{"reqtype"} =~ /^(r|c)$/
!ll&&!rl&&r
000
exists $prereq_pm->{"requires"}{$need_module} or exists $prereq_pm->{"opt_requires"}{$need_module}
l!l&&r!l&&!r
000
MC/DC0%0/6
$self->{"reqtype"} and $self->{"reqtype"} =~ /^(r|c)$/ and exists $prereq_pm->{"requires"}{$need_module} || exists $prereq_pm->{"opt_requires"}{$need_module} and $nmo and not $inst_file
$self->{"reqtype"} $self->{"reqtype"} =~ /^(r|c)$/ exists $prereq_pm->{"requires"}{$need_module} exists $prereq_pm->{"opt_requires"}{$need_module} $nmo not $inst_file
Truth table0%0/9
A and B and C or D and E and not(F)
A= $self->{"reqtype"}B= $self->{"reqtype"} =~ /^(r|c)$/C= exists $prereq_pm->{"requires"}{$need_module}D= exists $prereq_pm->{"opt_requires"}{$need_module}E= $nmoF= not $inst_file
ABCDEFresult
0XXXXX0
10XXXX0
1100XX0
111X0X0
11010X0
111X100
1101100
111X111
1101111
3077 $self->{reqtype} # e.g. maybe we came via goto?
3078 && $self->{reqtype} =~ /^(r|c)$/
3079 && ( exists $prereq_pm->{requires}{$need_module}
3080 || exists $prereq_pm->{opt_requires}{$need_module} )
3081 && $nmo
3082 && !$inst_file
3083 ) {
3084 # continue installing as a prereq; this may be a
3085 # distro we already used when it was a build_requires
3086 # so we did not install it. But suddenly somebody
3087 # wants it as a requires
3088 0 my $need_distro = $nmo->distribution;
3089 0 ▶ if ($need_distro->{install} && $need_distro->{install}->failed && $need_distro->{install}->text =~ /is only/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($need_distro->{"install"} and $need_distro->{"install"}->failed and $need_distro->{"install"}->text =~ /is only/) 0 0 0
Condition0%0/6
$need_distro->{"install"} and $need_distro->{"install"}->failed and $need_distro->{"install"}->text =~ /is only/
!ll&&!rl&&r
000
$need_distro->{"install"} and $need_distro->{"install"}->failed
!ll&&!rl&&r
000
MC/DC0%0/3
$need_distro->{"install"} and $need_distro->{"install"}->failed and $need_distro->{"install"}->text =~ /is only/
$need_distro->{"install"} $need_distro->{"install"}->failed $need_distro->{"install"}->text =~ /is only/
Truth table0%0/4
A and B and C
A= $need_distro->{"install"}B= $need_distro->{"install"}->failedC= $need_distro->{"install"}->text =~ /is only/
ABCresult
0XX0
10X0
1100
1111
3090 0 my $id = $need_distro->pretty_id;
3091 0 $CPAN::Frontend->myprint("Promoting $id from build_requires to requires due $need_module\n");
3092 0 delete $need_distro->{install}; # promote to another installation attempt
3093 0 $need_distro->{reqtype} = "r";
3094 0 $need_distro->install;
3095 0 next NEED;
3096 }
3097 }
3098 else {
3099 0 ▶ next NEED if $fulfills_all_version_rqs;
Branch: 1 branch
BranchTrueFalseTotal
if $fulfills_all_version_rqs 0 0 0
3100 }
3101 }
3102  
3103 0 ▶ if ($need_module eq "perl") {
Branch: 1 branch
BranchTrueFalseTotal
if ($need_module eq "perl") 0 0 0
3104 0 return ["perl", $need_version];
3105 }
3106 0 ▶ $self->{sponsored_mods}{$need_module} ||= 0;
Condition0%0/2
$self->{"sponsored_mods"}{$need_module} ||= 0
l!l
00
MC/DC0%0/1
$self->{"sponsored_mods"}{$need_module} ||= 0
$self->{"sponsored_mods"}{$need_module}
Truth table0%0/2
A
A= $self->{"sponsored_mods"}{$need_module}
Aresult
11
00
3107 0 ▶ CPAN->debug("need_module[$need_module]s/s/n[$self->{sponsored_mods}{$need_module}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3108 0 ▶ if (my $sponsoring = $self->{sponsored_mods}{$need_module}++) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $sponsoring = $self->{"sponsored_mods"}{$need_module}++) 0 0 0
3109 # We have already sponsored it and for some reason it's still
3110 # not available. So we do ... what??
3111  
3112 # if we push it again, we have a potential infinite loop
3113  
3114 # The following "next" was a very problematic construct.
3115 # It helped a lot but broke some day and had to be
3116 # replaced.
3117  
3118 # We must be able to deal with modules that come again and
3119 # again as a prereq and have themselves prereqs and the
3120 # queue becomes long but finally we would find the correct
3121 # order. The RecursiveDependency check should trigger a
3122 # die when it's becoming too weird. Unfortunately removing
3123 # this next breaks many other things.
3124  
3125 # The bug that brought this up is described in Todo under
3126 # "5.8.9 cannot install Compress::Zlib"
3127  
3128 # next; # this is the next that had to go away
3129  
3130 # The following "next NEED" are fine and the error message
3131 # explains well what is going on. For example when the DBI
3132 # fails and consequently DBD::SQLite fails and now we are
3133 # processing CPAN::SQLite. Then we must have a "next" for
3134 # DBD::SQLite. How can we get it and how can we identify
3135 # all other cases we must identify?
3136  
3137 0 my $do = $nmo->distribution;
3138 0 ▶ next NEED unless $do; # not on CPAN
Branch: 1 branch
BranchTrueFalseTotal
unless $do 0 0 0
3139 0 ▶ if (CPAN::Version->vcmp($need_version, $nmo->ro->{CPAN_VERSION}) > 0){
Branch: 1 branch
BranchTrueFalseTotal
if ("CPAN::Version"->vcmp($need_version, $nmo->ro->{"CPAN_VERSION"}) > 0) 0 0 0
3140 0 $CPAN::Frontend->mywarn("Warning: Prerequisite ".
3141 "'$need_module => $need_version' ".
3142 "for '$self->{ID}' seems ".
3143 "not available according to the indices\n"
3144 );
3145 0 next NEED;
3146 }
3147 0 NOSAYER: for my $nosayer (
3148 "unwrapped",
3149 "writemakefile",
3150 "signature_verify",
3151 "make",
3152 "make_test",
3153 "install",
3154 "make_clean",
3155 ) {
3156 0 ▶ if ($do->{$nosayer}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($do->{$nosayer}) 0 0 0
3157 0 my $selfid = $self->pretty_id;
3158 0 my $did = $do->pretty_id;
3159 0 ▶ if (UNIVERSAL::can($do->{$nosayer},"failed") ?
Branch: 2 branches
BranchTrueFalseTotal
if (UNIVERSAL::can($do->{$nosayer}, 'failed') ? $do->{$nosayer}->failed : $do->{$nosayer} =~ /^NO/) { } 0 0 0
UNIVERSAL::can($do->{$nosayer}, 'failed') ? : 0 0 0
3160 $do->{$nosayer}->failed :
3161 $do->{$nosayer} =~ /^NO/) {
3162 0 ▶ if ($nosayer eq "make_test"
Branch: 1 branch
BranchTrueFalseTotal
if ($nosayer eq "make_test" and $do->{"make_test"}{"COMMANDID"} != $CPAN::CurrentCommandId) 0 0 0
Condition0%0/3
$nosayer eq "make_test" and $do->{"make_test"}{"COMMANDID"} != $CPAN::CurrentCommandId
!ll&&!rl&&r
000
MC/DC0%0/2
$nosayer eq "make_test" and $do->{"make_test"}{"COMMANDID"} != $CPAN::CurrentCommandId
$nosayer eq "make_test" $do->{"make_test"}{"COMMANDID"} != $CPAN::CurrentCommandId
Truth table0%0/3
A and B
A= $nosayer eq "make_test"B= $do->{"make_test"}{"COMMANDID"} != $CPAN::CurrentCommandId
ABresult
0X0
100
111
3163 &&
3164 $do->{make_test}{COMMANDID} != $CPAN::CurrentCommandId
3165 ) {
3166 0 next NOSAYER;
3167 }
3168 ### XXX don't complain about missing optional deps -- xdg, 2012-04-01
3169 0 ▶ if ($self->is_locally_optional($prereq_pm, $need_module)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_locally_optional($prereq_pm, $need_module)) { } 0 0 0
3170 # don't complain about failing optional prereqs
3171 }
3172 else {
3173 0 $CPAN::Frontend->mywarn("Warning: Prerequisite ".
3174 "'$need_module => $need_version' ".
3175 "for '$selfid' failed when ".
3176 "processing '$did' with ".
3177 "'$nosayer => $do->{$nosayer}'. Continuing, ".
3178 "but chances to succeed are limited.\n"
3179 );
3180 0 $CPAN::Frontend->mysleep($sponsoring/10);
3181 }
3182 0 next NEED;
3183 } else { # the other guy succeeded
3184 0 ▶ if ($nosayer =~ /^(install|make_test)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nosayer =~ /^(install|make_test)$/) 0 0 0
3185 # we had this with
3186 # DMAKI/DateTime-Calendar-Chinese-0.05.tar.gz
3187 # in 2007-03 for 'make install'
3188 # and 2008-04: #30464 (for 'make test')
3189 # $CPAN::Frontend->mywarn("Warning: Prerequisite ".
3190 # "'$need_module => $need_version' ".
3191 # "for '$selfid' already built ".
3192 # "but the result looks suspicious. ".
3193 # "Skipping another build attempt, ".
3194 # "to prevent looping endlessly.\n"
3195 # );
3196 0 next NEED;
3197 }
3198 }
3199 }
3200 }
3201 }
3202 0 my $needed_as;
3203 0 ▶ if (0) {
Branch: 2 branches
BranchTrueFalseTotal
if (do { exists $prereq_pm->{'requires'}{$need_module} or exists $prereq_pm->{'opt_requires'}{$need_module} }) { } 0 0 0
elsif ($slot eq 'configure_requires_later') { } 0 0 0
3204 ▶ } elsif (exists $prereq_pm->{requires}{$need_module}
Condition0%0/3
exists $prereq_pm->{"requires"}{$need_module} or exists $prereq_pm->{"opt_requires"}{$need_module}
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $prereq_pm->{"requires"}{$need_module} or exists $prereq_pm->{"opt_requires"}{$need_module}
exists $prereq_pm->{"requires"}{$need_module} exists $prereq_pm->{"opt_requires"}{$need_module}
Truth table0%0/3
A or B
A= exists $prereq_pm->{"requires"}{$need_module}B= exists $prereq_pm->{"opt_requires"}{$need_module}
ABresult
1X1
011
000
3205 || exists $prereq_pm->{opt_requires}{$need_module}
3206 ) {
3207 0 $needed_as = "r";
3208 } elsif ($slot eq "configure_requires_later") {
3209 # in ae872487d5 we said: C< we have not yet run the
3210 # {Build,Makefile}.PL, we must presume "r" >; but the
3211 # meta.yml standard says C< These dependencies are not
3212 # required after the distribution is installed. >; so now
3213 # we change it back to "b" and care for the proper
3214 # promotion later.
3215 0 $needed_as = "b";
3216 } else {
3217 0 $needed_as = "b";
3218 }
3219 # here need to flag as optional for recommends/suggests
3220 # -- xdg, 2012-04-01
3221 $self->debug(sprintf "%s mandatory?[%s]",
3222 $self->pretty_id,
3223 0 ▶ defined($self->{mandatory}) ? $self->{mandatory} : "<undef>")
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
defined $self->{'mandatory'} ? : 0 0 0
3224 if $CPAN::DEBUG;
3225 my $optional = !$self->{mandatory}
3226 0 ▶ || $self->is_locally_optional($prereq_pm, $need_module);
Condition0%0/3
!$self->{'mandatory'} || $self->is_locally_optional($prereq_pm, $need_module)
l!l&&r!l&&!r
000
MC/DC0%0/2
!$self->{'mandatory'} || $self->is_locally_optional($prereq_pm, $need_module)
!$self->{'mandatory'} $self->is_locally_optional($prereq_pm, $need_module)
Truth table0%0/3
not(A) || B
A= !$self->{'mandatory'}B= $self->is_locally_optional($prereq_pm, $need_module)
ABresult
1X1
011
000
3227 0 push @need, [$need_module,$needed_as,$optional];
3228 }
3229 0 my @unfolded = map { "[".join(",",@$_)."]" } @need;
3230 11 ▶ CPAN->debug("returning from unsat_prereq[@unfolded]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 11 11
3231 11 @need;
3232 }
3233  
3234 0 ▶sub _fulfills_all_version_rqs {
Subroutine _fulfills_all_version_rqs: not called CC=13 SCAR=52.0
3235 0 my($self,$need_module,$available_file,$available_version,$need_version) = @_;
3236 0 my(@all_requirements) = split /\s*,\s*/, $need_version;
3237 0 local($^W) = 0;
3238 0 my $ok = 0;
3239 0 RQ: for my $rq (@all_requirements) {
3240 0 ▶ if ($rq =~ s|>=\s*||) {
Branch: 5 branches
BranchTrueFalseTotal
if ($rq =~ s/>=\s*//) { } 0 0 0
elsif ($rq =~ s/>\s*//) { } 0 0 0
elsif ($rq =~ s/!=\s*//) { } 0 0 0
elsif ($rq =~ /<=?\s*/) { } 0 0 0
elsif ($rq =~ s/==\s*//) { } 0 0 0
3241 } elsif ($rq =~ s|>\s*||) {
3242 # 2005-12: one user
3243 0 ▶ if (CPAN::Version->vgt($available_version,$rq)) {
Branch: 1 branch
BranchTrueFalseTotal
if ("CPAN::Version"->vgt($available_version, $rq)) 0 0 0
3244 0 $ok++;
3245 }
3246 0 next RQ;
3247 } elsif ($rq =~ s|!=\s*||) {
3248 # 2005-12: no user
3249 0 ▶ if (CPAN::Version->vcmp($available_version,$rq)) {
Branch: 1 branch
BranchTrueFalseTotal
if ('CPAN::Version'->vcmp($available_version, $rq)) { } 0 0 0
3250 0 $ok++;
3251 0 next RQ;
3252 } else {
3253 0 $ok=0;
3254 0 last RQ;
3255 }
3256 } elsif ($rq =~ m|<=?\s*|) {
3257 # 2005-12: no user
3258 0 $CPAN::Frontend->mywarn("Downgrading not supported (rq[$rq])\n");
3259 0 $ok++;
3260 0 next RQ;
3261 } elsif ($rq =~ s|==\s*||) {
3262 # 2009-07: ELLIOTJS/Perl-Critic-1.099_002.tar.gz
3263 0 ▶ if (CPAN::Version->vcmp($available_version,$rq)) {
Branch: 1 branch
BranchTrueFalseTotal
if ('CPAN::Version'->vcmp($available_version, $rq)) { } 0 0 0
3264 0 $ok=0;
3265 0 last RQ;
3266 } else {
3267 0 $ok++;
3268 0 next RQ;
3269 }
3270 }
3271 0 ▶ if (! CPAN::Version->vgt($rq, $available_version)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("CPAN::Version"->vgt($rq, $available_version)) 0 0 0
3272 0 $ok++;
3273 }
3274 0 ▶ CPAN->debug(sprintf("need_module[%s]available_file[%s]".
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3275 "available_version[%s]rq[%s]ok[%d]",
3276 $need_module,
3277 $available_file,
3278 $available_version,
3279 CPAN::Version->readable($rq),
3280 $ok,
3281 )) if $CPAN::DEBUG;
3282 }
3283 0 my $ret = $ok == @all_requirements;
3284 0 ▶ CPAN->debug(sprintf("need_module[%s]ok[%s]all_requirements[%d]",$need_module, $ok, scalar @all_requirements)) if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3285 0 return $ret;
3286 }
3287  
3288 #-> sub CPAN::Distribution::read_meta
3289 # read any sort of meta files, return CPAN::Meta object if no errors
3290 36 ▶sub read_meta {
Subroutine read_meta: called CC=7 SCAR=24.6
Pod undocumented
3291 36 my($self) = @_;
3292 36 ▶ my $meta_file = $self->pick_meta_file
Branch: 1 branch
BranchTrueFalseTotal
my $meta_file = $self->pick_meta_file or return 34 2 36
3293 or return;
3294  
3295 34 ▶ return unless $CPAN::META->has_usable("CPAN::Meta");
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::META->has_usable("CPAN::Meta") 0 34 34
3296 34 ▶ my $meta = eval { CPAN::Meta->load_file($meta_file)}
Branch: 1 branch
BranchTrueFalseTotal
my $meta = eval { do { "CPAN::Meta"->load_file($meta_file) } } or return 34 0 34
3297 or return;
3298  
3299 # Very old EU::MM could have wrong META
3300 34 ▶ if ($meta_file eq 'META.yml'
Branch: 1 branch
BranchTrueFalseTotal
if ($meta_file eq "META.yml" and $meta->generated_by =~ /ExtUtils::MakeMaker version ([\d\._]+)/) 0 34 34
Condition33%1/3
$meta_file eq "META.yml" and $meta->generated_by =~ /ExtUtils::MakeMaker version ([\d\._]+)/
!ll&&!rl&&r
3400
MC/DC0%0/2
$meta_file eq "META.yml" and $meta->generated_by =~ /ExtUtils::MakeMaker version ([\d\._]+)/
$meta_file eq "META.yml" $meta->generated_by =~ /ExtUtils::MakeMaker version ([\d\._]+)/
Truth table33%1/3
A and B
A= $meta_file eq "META.yml"B= $meta->generated_by =~ /ExtUtils::MakeMaker version ([\d\._]+)/
ABresult
0X0
100
111
3301 && $meta->generated_by =~ /ExtUtils::MakeMaker version ([\d\._]+)/
3302 ) {
3303 0 my $eummv = do { local $^W = 0; $1+0; };
3304 0 ▶ return if $eummv < 6.2501;
Branch: 1 branch
BranchTrueFalseTotal
if $eummv < "6.2501" 0 0 0
3305 }
3306  
3307 34 return $meta;
3308 }
3309  
3310 #-> sub CPAN::Distribution::read_yaml ;
3311 # XXX This should be DEPRECATED -- dagolden, 2011-02-05
3312 8 ▶sub read_yaml {
Subroutine read_yaml: called CC=15 SCAR=32.6
Pod undocumented
3313 8 my($self) = @_;
3314 8 my $meta_file = $self->pick_meta_file('\.yml$');
3315 8 ▶ $self->debug("meta_file[$meta_file]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 8 8
3316 8 ▶ return unless $meta_file;
Branch: 1 branch
BranchTrueFalseTotal
unless $meta_file 2 6 8
3317 6 my $yaml;
3318 6 eval { $yaml = $self->parse_meta_yml($meta_file) };
3319 6 ▶ if ($@ or ! $yaml) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@ or not $yaml) 0 6 6
Condition33%1/3
$@ or not $yaml
l!l&&r!l&&!r
006
MC/DC0%0/2
$@ or not $yaml
$@ not $yaml
Truth table33%1/3
A or not(B)
A= $@B= not $yaml
ABresult
1X1
011
000
3320 0 return undef; # if we die, then we cannot read YAML's own META.yml
3321 }
3322 # not "authoritative"
3323 6 ▶ if (defined $yaml && (! ref $yaml || ref $yaml ne "HASH")) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $yaml and !ref($yaml) || ref $yaml ne "HASH") 0 6 6
Condition33%2/6
defined $yaml and !ref($yaml) || ref $yaml ne "HASH"
!ll&&!rl&&r
060
not ref $yaml or ref $yaml ne "HASH"
l!l&&r!l&&!r
006
MC/DC0%0/3
defined $yaml and !ref($yaml) || ref $yaml ne "HASH"
defined $yaml not ref $yaml ref $yaml ne "HASH"
Truth table25%1/4
A and not(B) or C
A= defined $yamlB= not ref $yamlC= ref $yaml ne "HASH"
ABCresult
0XX0
1000
11X1
1011
3324 0 $CPAN::Frontend->mywarn("META.yml does not seem to be conforming, cannot use it.\n");
3325 0 $yaml = undef;
3326 }
3327 6 ▶ $self->debug(sprintf "yaml[%s]", $yaml || "UNDEF")
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 6 6
Condition0%0/2
$yaml || 'UNDEF'
l!l
00
MC/DC0%0/1
$yaml || 'UNDEF'
$yaml
Truth table0%0/2
A
A= $yaml
Aresult
11
00
3328 if $CPAN::DEBUG;
3329 6 ▶ $self->debug($yaml) if $CPAN::DEBUG && $yaml;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG and $yaml 0 6 6
Condition33%1/3
$CPAN::DEBUG and $yaml
!ll&&!rl&&r
600
MC/DC0%0/2
$CPAN::DEBUG and $yaml
$CPAN::DEBUG $yaml
Truth table33%1/3
A and B
A= $CPAN::DEBUGB= $yaml
ABresult
0X0
100
111
3330 # MYMETA.yml is static and authoritative by definition
3331 6 ▶ if ( $meta_file =~ /MYMETA\.yml/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($meta_file =~ /MYMETA\.yml/) 2 4 6
3332 2 return $yaml;
3333 }
3334 # META.yml is authoritative only if dynamic_config is defined and false
3335 4 ▶ if ( defined $yaml->{dynamic_config} && ! $yaml->{dynamic_config} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $yaml->{"dynamic_config"} and not $yaml->{"dynamic_config"}) 2 2 4
Condition66%2/3
defined $yaml->{"dynamic_config"} and not $yaml->{"dynamic_config"}
!ll&&!rl&&r
022
MC/DC50%1/2
defined $yaml->{"dynamic_config"} and not $yaml->{"dynamic_config"}
defined $yaml->{"dynamic_config"} not $yaml->{"dynamic_config"}
Truth table66%2/3
A and not(B)
A= defined $yaml->{"dynamic_config"}B= not $yaml->{"dynamic_config"}
ABresult
0X0
100
111
3336 2 return $yaml;
3337 }
3338 # otherwise, we can't use what we found
3339 2 return undef;
3340 }
3341  
3342 #-> sub CPAN::Distribution::configure_requires ;
3343 7 ▶sub configure_requires {
Subroutine configure_requires: called CC=4 SCAR=25.0
Pod undocumented
3344 7 my($self) = @_;
3345 7 ▶ return unless my $meta_file = $self->pick_meta_file('^META');
Branch: 1 branch
BranchTrueFalseTotal
unless my $meta_file = $self->pick_meta_file("^META") 7 0 7
3346 0 ▶ if (my $meta_obj = $self->read_meta) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $meta_obj = $self->read_meta) { } 0 0 0
3347 0 my $prereqs = $meta_obj->effective_prereqs;
3348 0 my $cr = $prereqs->requirements_for(qw/configure requires/);
3349 0 ▶ return $cr ? $cr->as_string_hash : undef;
Branch: 1 branch
BranchTrueFalseTotal
$cr ? : 0 0 0
3350 }
3351 else {
3352 0 my $yaml = eval { $self->parse_meta_yml($meta_file) };
3353 0 return $yaml->{configure_requires};
3354 }
3355 }
3356  
3357 #-> sub CPAN::Distribution::prereq_pm ;
3358 24 ▶sub prereq_pm {
Subroutine prereq_pm: called CC=64 SCAR=75.8
Pod undocumented
3359 24 my($self) = @_;
3360 return unless $self->{writemakefile} # no need to have succeeded
3361 # but we must have run it
3362 24 ▶ || $self->{modulebuild};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"writemakefile"} or $self->{"modulebuild"} 7 17 24
Condition66%2/3
$self->{"writemakefile"} or $self->{"modulebuild"}
l!l&&r!l&&!r
1707
MC/DC50%1/2
$self->{"writemakefile"} or $self->{"modulebuild"}
$self->{"writemakefile"} $self->{"modulebuild"}
Truth table66%2/3
A or B
A= $self->{"writemakefile"}B= $self->{"modulebuild"}
ABresult
1X1
011
000
3363 17 ▶ unless ($self->{build_dir}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"build_dir"}) 0 17 17
3364 0 return;
3365 }
3366 17 ▶ if ($self->{cleanup_after_install_done}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"cleanup_after_install_done"}) 0 17 17
3367 0 return;
3368 }
3369 # no Makefile/Build means configuration aborted, so don't look for prereqs
3370 17 ▶ my $makefile = File::Spec->catfile($self->{build_dir}, $^O eq 'VMS' ? 'descrip.mms' : 'Makefile');
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'VMS' ? : 0 17 17
3371 17 ▶ my $buildfile = File::Spec->catfile($self->{build_dir}, $^O eq 'VMS' ? 'Build.com' : 'Build');
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'VMS' ? : 0 17 17
3372 17 ▶ return unless -f $makefile || -f $buildfile;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $makefile or -f $buildfile 3 14 17
Condition66%2/3
-f $makefile or -f $buildfile
l!l&&r!l&&!r
1403
MC/DC50%1/2
-f $makefile or -f $buildfile
-f $makefile -f $buildfile
Truth table66%2/3
A or B
A= -f $makefileB= -f $buildfile
ABresult
1X1
011
000
3373 CPAN->debug(sprintf "writemakefile[%s]modulebuild[%s]",
3374 $self->{writemakefile}||"",
3375 14 ▶ $self->{modulebuild}||"",
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 14 14
Condition0%0/4
$self->{'writemakefile'} || ''
l!l
00
$self->{'modulebuild'} || ''
l!l
00
MC/DC0%0/1
$self->{'writemakefile'} || ''
$self->{'writemakefile'}
MC/DC0%0/1
$self->{'modulebuild'} || ''
$self->{'modulebuild'}
Truth table0%0/2
A
A= $self->{'writemakefile'}
Aresult
11
00
Truth table0%0/2
A
A= $self->{'modulebuild'}
Aresult
11
00
3376 ) if $CPAN::DEBUG;
3377 14 my($req,$breq, $opt_req, $opt_breq);
3378 14 my $meta_obj = $self->read_meta;
3379 # META/MYMETA is only authoritative if dynamic_config is false
3380 14 ▶ if ($meta_obj && ! $meta_obj->dynamic_config) {
Branch: 2 branches
BranchTrueFalseTotal
if ($meta_obj and not $meta_obj->dynamic_config) { } 14 0 14
elsif (my $yaml = $self->read_yaml) { } 0 0 0
Condition33%1/3
$meta_obj and not $meta_obj->dynamic_config
!ll&&!rl&&r
0014
MC/DC0%0/2
$meta_obj and not $meta_obj->dynamic_config
$meta_obj not $meta_obj->dynamic_config
Truth table33%1/3
A and not(B)
A= $meta_objB= not $meta_obj->dynamic_config
ABresult
0X0
100
111
3381 14 my $prereqs = $meta_obj->effective_prereqs;
3382 14 my $requires = $prereqs->requirements_for(qw/runtime requires/);
3383 14 my $build_requires = $prereqs->requirements_for(qw/build requires/);
3384 14 my $test_requires = $prereqs->requirements_for(qw/test requires/);
3385 # XXX we don't yet distinguish build vs test, so merge them for now
3386 14 $build_requires->add_requirements($test_requires);
3387 14 $req = $requires->as_string_hash;
3388 14 $breq = $build_requires->as_string_hash;
3389  
3390 # XXX assemble optional_req && optional_breq from recommends/suggests
3391 # depending on corresponding policies -- xdg, 2012-04-01
3392 14 CPAN->use_inst("CPAN::Meta::Requirements");
3393 14 my $opt_runtime = CPAN::Meta::Requirements->new;
3394 14 my $opt_build = CPAN::Meta::Requirements->new;
3395 14 ▶ if ( $CPAN::Config->{recommends_policy} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"recommends_policy"}) 0 14 14
3396 0 $opt_runtime->add_requirements( $prereqs->requirements_for(qw/runtime recommends/));
3397 0 $opt_build->add_requirements( $prereqs->requirements_for(qw/build recommends/));
3398 0 $opt_build->add_requirements( $prereqs->requirements_for(qw/test recommends/));
3399  
3400 }
3401 14 ▶ if ( $CPAN::Config->{suggests_policy} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"suggests_policy"}) 0 14 14
3402 0 $opt_runtime->add_requirements( $prereqs->requirements_for(qw/runtime suggests/));
3403 0 $opt_build->add_requirements( $prereqs->requirements_for(qw/build suggests/));
3404 0 $opt_build->add_requirements( $prereqs->requirements_for(qw/test suggests/));
3405 }
3406 14 $opt_req = $opt_runtime->as_string_hash;
3407 14 $opt_breq = $opt_build->as_string_hash;
3408 }
3409 elsif (my $yaml = $self->read_yaml) { # often dynamic_config prevents a result here
3410 0 ▶ $req = $yaml->{requires} || {};
Condition0%0/2
$yaml->{'requires'} || {}
l!l
00
MC/DC0%0/1
$yaml->{'requires'} || {}
$yaml->{'requires'}
Truth table0%0/2
A
A= $yaml->{'requires'}
Aresult
11
00
3411 0 ▶ $breq = $yaml->{build_requires} || {};
Condition0%0/2
$yaml->{'build_requires'} || {}
l!l
00
MC/DC0%0/1
$yaml->{'build_requires'} || {}
$yaml->{'build_requires'}
Truth table0%0/2
A
A= $yaml->{'build_requires'}
Aresult
11
00
3412 0 ▶ if ( $CPAN::Config->{recommends_policy} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"recommends_policy"}) 0 0 0
3413 0 ▶ $opt_req = $yaml->{recommends} || {};
Condition0%0/2
$yaml->{'recommends'} || {}
l!l
00
MC/DC0%0/1
$yaml->{'recommends'} || {}
$yaml->{'recommends'}
Truth table0%0/2
A
A= $yaml->{'recommends'}
Aresult
11
00
3414 }
3415 0 ▶ undef $req unless ref $req eq "HASH" && %$req;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $req eq "HASH" and %$req 0 0 0
Condition0%0/3
ref $req eq "HASH" and %$req
!ll&&!rl&&r
000
MC/DC0%0/2
ref $req eq "HASH" and %$req
ref $req eq "HASH" %$req
Truth table0%0/3
A and B
A= ref $req eq "HASH"B= %$req
ABresult
0X0
100
111
3416 0 ▶ if ($req) {
Branch: 1 branch
BranchTrueFalseTotal
if ($req) 0 0 0
3417 0 ▶ if ($yaml->{generated_by} &&
Branch: 1 branch
BranchTrueFalseTotal
if ($yaml->{"generated_by"} and $yaml->{"generated_by"} =~ /ExtUtils::MakeMaker version ([\d\._]+)/) 0 0 0
Condition0%0/3
$yaml->{"generated_by"} and $yaml->{"generated_by"} =~ /ExtUtils::MakeMaker version ([\d\._]+)/
!ll&&!rl&&r
000
MC/DC0%0/2
$yaml->{"generated_by"} and $yaml->{"generated_by"} =~ /ExtUtils::MakeMaker version ([\d\._]+)/
$yaml->{"generated_by"} $yaml->{"generated_by"} =~ /ExtUtils::MakeMaker version ([\d\._]+)/
Truth table0%0/3
A and B
A= $yaml->{"generated_by"}B= $yaml->{"generated_by"} =~ /ExtUtils::MakeMaker version ([\d\._]+)/
ABresult
0X0
100
111
3418 $yaml->{generated_by} =~ /ExtUtils::MakeMaker version ([\d\._]+)/) {
3419 0 my $eummv = do { local $^W = 0; $1+0; };
3420 0 ▶ if ($eummv < 6.2501) {
Branch: 1 branch
BranchTrueFalseTotal
if ($eummv < "6.2501") 0 0 0
3421 # thanks to Slaven for digging that out: MM before
3422 # that could be wrong because it could reflect a
3423 # previous release
3424 0 undef $req;
3425 }
3426 }
3427 0 my $areq;
3428 my $do_replace;
3429 0 ▶ foreach my $k (sort keys %{$req||{}}) {
Condition0%0/2
$req || {}
l!l
00
MC/DC0%0/1
$req || {}
$req
Truth table0%0/2
A
A= $req
Aresult
11
00
3430 0 my $v = $req->{$k};
3431 0 ▶ next unless defined $v;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $v 0 0 0
3432 0 ▶ if ($v =~ /\d/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($v =~ /\d/) { } 0 0 0
elsif ($k =~ /[A-Za-z]/ and $v =~ /[A-Za-z]/ and $CPAN::META->exists('CPAN::Module', $v)) { } 0 0 0
3433 0 $areq->{$k} = $v;
3434 ▶ } elsif ($k =~ /[A-Za-z]/ &&
Condition0%0/6
$k =~ /[A-Za-z]/ and $v =~ /[A-Za-z]/ and $CPAN::META->exists("CPAN::Module", $v)
!ll&&!rl&&r
000
$k =~ /[A-Za-z]/ and $v =~ /[A-Za-z]/
!ll&&!rl&&r
000
MC/DC0%0/3
$k =~ /[A-Za-z]/ and $v =~ /[A-Za-z]/ and $CPAN::META->exists("CPAN::Module", $v)
$k =~ /[A-Za-z]/ $v =~ /[A-Za-z]/ $CPAN::META->exists("CPAN::Module", $v)
Truth table0%0/4
A and B and C
A= $k =~ /[A-Za-z]/B= $v =~ /[A-Za-z]/C= $CPAN::META->exists("CPAN::Module", $v)
ABCresult
0XX0
10X0
1100
1111
3435 $v =~ /[A-Za-z]/ &&
3436 $CPAN::META->exists("CPAN::Module",$v)
3437 ) {
3438 0 $CPAN::Frontend->mywarn("Suspicious key-value pair in META.yml's ".
3439 "requires hash: $k => $v; I'll take both ".
3440 "key and value as a module name\n");
3441 0 $CPAN::Frontend->mysleep(1);
3442 0 $areq->{$k} = 0;
3443 0 $areq->{$v} = 0;
3444 0 $do_replace++;
3445 }
3446 }
3447 0 ▶ $req = $areq if $do_replace;
Branch: 1 branch
BranchTrueFalseTotal
if $do_replace 0 0 0
3448 }
3449 }
3450 else {
3451 0 $CPAN::Frontend->mywarnonce("Could not read metadata file. Falling back to other ".
3452 "methods to determine prerequisites\n");
3453 }
3454  
3455 14 ▶ unless ($req || $breq) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($req or $breq) 0 14 14
Condition33%1/3
$req or $breq
l!l&&r!l&&!r
1400
MC/DC0%0/2
$req or $breq
$req $breq
Truth table33%1/3
A or B
A= $reqB= $breq
ABresult
1X1
011
000
3456 0 my $build_dir;
3457 0 ▶ unless ( $build_dir = $self->{build_dir} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($build_dir = $self->{"build_dir"}) 0 0 0
3458 0 return;
3459 }
3460 0 my $makefile = File::Spec->catfile($build_dir,"Makefile");
3461 0 my $fh;
3462 0 ▶ if (-f $makefile
Branch: 1 branch
BranchTrueFalseTotal
if (-f $makefile and $fh = "FileHandle"->new("<$makefile\000")) 0 0 0
Condition0%0/3
-f $makefile and $fh = "FileHandle"->new("<$makefile\000")
!ll&&!rl&&r
000
MC/DC0%0/2
-f $makefile and $fh = "FileHandle"->new("<$makefile\000")
-f $makefile $fh = "FileHandle"->new("<$makefile\000")
Truth table0%0/3
A and B
A= -f $makefileB= $fh = "FileHandle"->new("<$makefile\000")
ABresult
0X0
100
111
3463 and
3464 $fh = FileHandle->new("<$makefile\0")) {
3465 0 ▶ CPAN->debug("Getting prereq from Makefile") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3466 0 local($/) = "\n";
3467 0 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
3468 0 ▶ last if /MakeMaker post_initialize section/;
Branch: 1 branch
BranchTrueFalseTotal
if /MakeMaker post_initialize section/ 0 0 0
3469 0 my($p) = m{^[\#]
3470 \s+PREREQ_PM\s+=>\s+(.+)
3471 }x;
3472 0 ▶ next unless $p;
Branch: 1 branch
BranchTrueFalseTotal
unless $p 0 0 0
3473 # warn "Found prereq expr[$p]";
3474  
3475 # Regexp modified by A.Speer to remember actual version of file
3476 # PREREQ_PM hash key wants, then add to
3477 0 ▶ while ( $p =~ m/(?:\s)([\w\:]+)=>(q\[.*?\]|undef),?/g ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($p =~ /(?:\s)([\w\:]+)=>(q\[.*?\]|undef),?/g) 0 0 0
3478 0 my($m,$n) = ($1,$2);
3479 # When a prereq is mentioned twice: let the bigger
3480 # win; usual culprit is that they declared
3481 # build_requires separately from requires; see
3482 # rt.cpan.org #47774
3483 0 my($prevn);
3484 0 ▶ if ( defined $req->{$m} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $req->{$m}) 0 0 0
3485 0 $prevn = $req->{$m};
3486 }
3487 0 ▶ if ($n =~ /^q\[(.*?)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n =~ /^q\[(.*?)\]$/) 0 0 0
3488 0 $n = $1;
3489 }
3490 0 ▶ if (!$prevn || CPAN::Version->vlt($prevn, $n)){
Branch: 1 branch
BranchTrueFalseTotal
if (not $prevn or "CPAN::Version"->vlt($prevn, $n)) 0 0 0
Condition0%0/3
not $prevn or "CPAN::Version"->vlt($prevn, $n)
l!l&&r!l&&!r
000
MC/DC0%0/2
not $prevn or "CPAN::Version"->vlt($prevn, $n)
not $prevn "CPAN::Version"->vlt($prevn, $n)
Truth table0%0/3
not(A) or B
A= not $prevnB= "CPAN::Version"->vlt($prevn, $n)
ABresult
1X1
011
000
3491 0 $req->{$m} = $n;
3492 }
3493 }
3494 0 last;
3495 }
3496 }
3497 }
3498 14 ▶ unless ($req || $breq) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($req or $breq) 0 14 14
Condition33%1/3
$req or $breq
l!l&&r!l&&!r
1400
MC/DC0%0/2
$req or $breq
$req $breq
Truth table33%1/3
A or B
A= $reqB= $breq
ABresult
1X1
011
000
3499 0 ▶ my $build_dir = $self->{build_dir} or die "Panic: no build_dir?";
Branch: 1 branch
BranchTrueFalseTotal
my $build_dir = $self->{"build_dir"} or die "Panic: no build_dir?" 0 0 0
3500 0 my $buildfile = File::Spec->catfile($build_dir,"Build");
3501 0 ▶ if (-f $buildfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $buildfile) 0 0 0
3502 0 ▶ CPAN->debug("Found '$buildfile'") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3503 0 my $build_prereqs = File::Spec->catfile($build_dir,"_build","prereqs");
3504 0 ▶ if (-f $build_prereqs) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $build_prereqs) 0 0 0
3505 0 ▶ CPAN->debug("Getting prerequisites from '$build_prereqs'") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3506 0 my $content = do { local *FH;
3507 0 ▶ open FH, $build_prereqs
Branch: 1 branch
BranchTrueFalseTotal
open FH, $build_prereqs or $CPAN::Frontend->mydie('Could not open ' . "'${build_prereqs}': $!") 0 0 0
3508 or $CPAN::Frontend->mydie("Could not open ".
3509 "'$build_prereqs': $!");
3510 0 local $/;
3511 0 <FH>;
3512 };
3513 0 my $bphash = eval $content;
3514 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 0 0
3515 } else {
3516 0 ▶ $req = $bphash->{requires} || +{};
Condition0%0/2
$bphash->{'requires'} || {}
l!l
00
MC/DC0%0/1
$bphash->{'requires'} || {}
$bphash->{'requires'}
Truth table0%0/2
A
A= $bphash->{'requires'}
Aresult
11
00
3517 0 ▶ $breq = $bphash->{build_requires} || +{};
Condition0%0/2
$bphash->{'build_requires'} || {}
l!l
00
MC/DC0%0/1
$bphash->{'build_requires'} || {}
$bphash->{'build_requires'}
Truth table0%0/2
A
A= $bphash->{'build_requires'}
Aresult
11
00
3518 }
3519 }
3520 }
3521 }
3522 # XXX needs to be adapted for optional_req & optional_breq -- xdg, 2012-04-01
3523 14 ▶ if ($req || $breq || $opt_req || $opt_breq ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($req or $breq or $opt_req or $opt_breq) 14 0 14
Condition33%3/9
$req or $breq or $opt_req or $opt_breq
l!l&&r!l&&!r
1400
$req or $breq or $opt_req
l!l&&r!l&&!r
1400
$req or $breq
l!l&&r!l&&!r
1400
MC/DC0%0/4
$req or $breq or $opt_req or $opt_breq
$req $breq $opt_req $opt_breq
Truth table20%1/5
A or B or C or D
A= $reqB= $breqC= $opt_reqD= $opt_breq
ABCDresult
1XXX1
01XX1
001X1
00011
00000
3524 return $self->{prereq_pm} = {
3525 14 requires => $req,
3526 build_requires => $breq,
3527 opt_requires => $opt_req,
3528 opt_build_requires => $opt_breq,
3529 };
3530 }
3531 }
3532  
3533 #-> sub CPAN::Distribution::shortcut_test ;
3534 # return values: undef means don't shortcut; 0 means shortcut as fail;
3535 # and 1 means shortcut as success
3536 4 ▶sub shortcut_test {
Subroutine shortcut_test: called CC=16 SCAR=43.7
Pod undocumented
3537 4 my ($self) = @_;
3538  
3539 4 ▶ $self->debug("checking badtestcnt[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 4 4
3540 4 ▶ $self->{badtestcnt} ||= 0;
Condition50%1/2
$self->{"badtestcnt"} ||= 0
l!l
04
MC/DC0%0/1
$self->{"badtestcnt"} ||= 0
$self->{"badtestcnt"}
Truth table50%1/2
A
A= $self->{"badtestcnt"}
Aresult
11
00
3541 4 ▶ if ($self->{badtestcnt} > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"badtestcnt"} > 0) 0 4 4
3542 0 require Data::Dumper;
3543 0 ▶ CPAN->debug(sprintf "NOREPEAT[%s]", Data::Dumper::Dumper($self)) if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3544 0 return $self->goodbye("Won't repeat unsuccessful test during this command");
3545 }
3546  
3547 4 for my $slot ( qw/later configure_requires_later/ ) {
3548 8 ▶ $self->debug("checking $slot slot[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 8 8
3549 return $self->success($self->{$slot})
3550 8 ▶ if $self->{$slot};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{$slot} 0 8 8
3551 }
3552  
3553 4 ▶ $self->debug("checking if tests passed[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 4 4
3554 4 ▶ if ( $self->{make_test} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"make_test"}) 0 4 4
3555 0 ▶ if (
Branch: 2 branches
BranchTrueFalseTotal
if (UNIVERSAL::can($self->{'make_test'}, 'failed') ? $self->{'make_test'}->failed : $self->{'make_test'} =~ /^NO/) { } 0 0 0
UNIVERSAL::can($self->{'make_test'}, 'failed') ? : 0 0 0
3556 UNIVERSAL::can($self->{make_test},"failed") ?
3557 $self->{make_test}->failed :
3558 $self->{make_test} =~ /^NO/
3559 ) {
3560 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::can($self->{"make_test"}, "commandid") and $self->{"make_test"}->commandid == $CPAN::CurrentCommandId) 0 0 0
Condition0%0/3
UNIVERSAL::can($self->{"make_test"}, "commandid") and $self->{"make_test"}->commandid == $CPAN::CurrentCommandId
!ll&&!rl&&r
000
MC/DC0%0/2
UNIVERSAL::can($self->{"make_test"}, "commandid") and $self->{"make_test"}->commandid == $CPAN::CurrentCommandId
UNIVERSAL::can($self->{"make_test"}, "commandid") $self->{"make_test"}->commandid == $CPAN::CurrentCommandId
Truth table0%0/3
A and B
A= UNIVERSAL::can($self->{"make_test"}, "commandid")B= $self->{"make_test"}->commandid == $CPAN::CurrentCommandId
ABresult
0X0
100
111
3561 UNIVERSAL::can($self->{make_test},"commandid")
3562 &&
3563 $self->{make_test}->commandid == $CPAN::CurrentCommandId
3564 ) {
3565 0 return $self->goodbye("Has already been tested within this command");
3566 }
3567 } else {
3568 # if global "is_tested" has been cleared, we need to mark this to
3569 # be added to PERL5LIB if not already installed
3570 0 ▶ if ($self->tested_ok_but_not_installed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->tested_ok_but_not_installed) 0 0 0
3571 0 $CPAN::META->is_tested($self->{build_dir},$self->{make_test}{TIME});
3572 }
3573 0 return $self->success("Has already been tested successfully");
3574 }
3575 }
3576  
3577 4 ▶ if ($self->{notest}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"notest"}) 0 4 4
3578 0 $self->{make_test} = CPAN::Distrostatus->new("YES");
3579 0 return $self->success("Skipping test because of notest pragma");
3580 }
3581  
3582 4 return undef; # no shortcut
3583 }
3584  
3585 #-> sub CPAN::Distribution::_exe_files ;
3586 0 ▶sub _exe_files {
Subroutine _exe_files: not called CC=24 SCAR=64.0
3587 0 my($self) = @_;
3588 return unless $self->{writemakefile} # no need to have succeeded
3589 # but we must have run it
3590 0 ▶ || $self->{modulebuild};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"writemakefile"} or $self->{"modulebuild"} 0 0 0
Condition0%0/3
$self->{"writemakefile"} or $self->{"modulebuild"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"writemakefile"} or $self->{"modulebuild"}
$self->{"writemakefile"} $self->{"modulebuild"}
Truth table0%0/3
A or B
A= $self->{"writemakefile"}B= $self->{"modulebuild"}
ABresult
1X1
011
000
3591 0 ▶ unless ($self->{build_dir}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"build_dir"}) 0 0 0
3592 0 return;
3593 }
3594 CPAN->debug(sprintf "writemakefile[%s]modulebuild[%s]",
3595 $self->{writemakefile}||"",
3596 0 ▶ $self->{modulebuild}||"",
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
Condition0%0/4
$self->{'writemakefile'} || ''
l!l
00
$self->{'modulebuild'} || ''
l!l
00
MC/DC0%0/1
$self->{'writemakefile'} || ''
$self->{'writemakefile'}
MC/DC0%0/1
$self->{'modulebuild'} || ''
$self->{'modulebuild'}
Truth table0%0/2
A
A= $self->{'writemakefile'}
Aresult
11
00
Truth table0%0/2
A
A= $self->{'modulebuild'}
Aresult
11
00
3597 ) if $CPAN::DEBUG;
3598 0 my $build_dir;
3599 0 ▶ unless ( $build_dir = $self->{build_dir} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($build_dir = $self->{"build_dir"}) 0 0 0
3600 0 return;
3601 }
3602 0 my $makefile = File::Spec->catfile($build_dir,"Makefile");
3603 0 my $fh;
3604 my @exe_files;
3605 0 ▶ if (-f $makefile
Branch: 1 branch
BranchTrueFalseTotal
if (-f $makefile and $fh = "FileHandle"->new("<$makefile\000")) 0 0 0
Condition0%0/3
-f $makefile and $fh = "FileHandle"->new("<$makefile\000")
!ll&&!rl&&r
000
MC/DC0%0/2
-f $makefile and $fh = "FileHandle"->new("<$makefile\000")
-f $makefile $fh = "FileHandle"->new("<$makefile\000")
Truth table0%0/3
A and B
A= -f $makefileB= $fh = "FileHandle"->new("<$makefile\000")
ABresult
0X0
100
111
3606 and
3607 $fh = FileHandle->new("<$makefile\0")) {
3608 0 ▶ CPAN->debug("Getting exefiles from Makefile") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3609 0 local($/) = "\n";
3610 0 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
3611 0 ▶ last if /MakeMaker post_initialize section/;
Branch: 1 branch
BranchTrueFalseTotal
if /MakeMaker post_initialize section/ 0 0 0
3612 0 my($p) = m{^[\#]
3613 \s+EXE_FILES\s+=>\s+\[(.+)\]
3614 }x;
3615 0 ▶ next unless $p;
Branch: 1 branch
BranchTrueFalseTotal
unless $p 0 0 0
3616 # warn "Found exefiles expr[$p]";
3617 0 my @p = split /,\s*/, $p;
3618 0 for my $p2 (@p) {
3619 0 ▶ if ($p2 =~ /^q\[(.+)\]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($p2 =~ /^q\[(.+)\]/) 0 0 0
3620 0 push @exe_files, $1;
3621 }
3622 }
3623 }
3624 }
3625 0 ▶ return \@exe_files if @exe_files;
Branch: 1 branch
BranchTrueFalseTotal
if @exe_files 0 0 0
3626 0 my $buildparams = File::Spec->catfile($build_dir,"_build","build_params");
3627 0 ▶ if (-f $buildparams) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $buildparams) 0 0 0
3628 0 ▶ CPAN->debug("Found '$buildparams'") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3629 0 my $x = do $buildparams;
3630 0 for my $sf ($x->[2]{script_files}) {
3631 0 ▶ if (my $reftype = ref $sf) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $reftype = ref $sf) { } 0 0 0
elsif (defined $sf) { } 0 0 0
3632 0 ▶ if ($reftype eq "ARRAY") {
Branch: 2 branches
BranchTrueFalseTotal
if ($reftype eq 'ARRAY') { } 0 0 0
elsif ($reftype eq 'HASH') { } 0 0 0
3633 0 push @exe_files, @$sf;
3634 }
3635 elsif ($reftype eq "HASH") {
3636 0 push @exe_files, keys %$sf;
3637 }
3638 else {
3639 0 $CPAN::Frontend->mywarn("Invalid reftype $reftype for Build.PL 'script_files'\n");
3640 }
3641 }
3642 elsif (defined $sf) {
3643 0 push @exe_files, $sf;
3644 }
3645 }
3646 }
3647 0 return \@exe_files;
3648 }
3649  
3650 #-> sub CPAN::Distribution::test ;
3651 7 ▶sub test {
Subroutine test: called CC=58 SCAR=63.9
Pod undocumented
3652 7 my($self) = @_;
3653  
3654 7 $self->pre_test();
3655  
3656 7 ▶ if (exists $self->{cleanup_after_install_done}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"cleanup_after_install_done"}) 0 7 7
3657 0 $self->post_test();
3658 0 return $self->make;
3659 }
3660  
3661 7 ▶ $self->debug("checking goto id[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
3662 7 ▶ if (my $goto = $self->prefs->{goto}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $goto = $self->prefs->{"goto"}) 0 7 7
3663 0 $self->post_test();
3664 0 return $self->goto($goto);
3665 }
3666  
3667 7 ▶ unless ($self->make){
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->make) 3 4 7
3668 3 $self->post_test();
3669 3 return;
3670 }
3671  
3672 4 ▶ if ( defined( my $sc = $self->shortcut_test ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $sc = $self->shortcut_test)) 0 4 4
3673 0 $self->post_test();
3674 0 return $sc;
3675 }
3676  
3677 4 ▶ if ($CPAN::Signal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Signal) 0 4 4
3678 0 delete $self->{force_update};
3679 0 $self->post_test();
3680 0 return;
3681 }
3682 # warn "XDEBUG: checking for notest: $self->{notest} $self";
3683 4 ▶ my $make = $self->{modulebuild} ? "Build" : "make";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'modulebuild'} ? : 0 4 4
3684  
3685 local $ENV{PERL5LIB} = defined($ENV{PERL5LIB})
3686 ? $ENV{PERL5LIB}
3687 4 ▶ : ($ENV{PERLLIB} || "");
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL5LIB'} ? : 4 0 4
Condition0%0/2
$ENV{"PERLLIB"} or ""
l!l
00
MC/DC0%0/1
$ENV{"PERLLIB"} or ""
$ENV{"PERLLIB"}
Truth table0%0/2
A
A= $ENV{"PERLLIB"}
Aresult
11
00
3688  
3689 4 ▶ local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : "";
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL5OPT'} ? : 4 0 4
3690 local $ENV{PERL_USE_UNSAFE_INC} =
3691 exists $ENV{PERL_USE_UNSAFE_INC} && defined $ENV{PERL_USE_UNSAFE_INC}
3692 4 ▶ ? $ENV{PERL_USE_UNSAFE_INC} : 1; # test
Branch: 1 branch
BranchTrueFalseTotal
exists $ENV{'PERL_USE_UNSAFE_INC'} && defined $ENV{'PERL_USE_UNSAFE_INC'} ? : 4 0 4
Condition33%1/3
exists $ENV{"PERL_USE_UNSAFE_INC"} and defined $ENV{"PERL_USE_UNSAFE_INC"}
!ll&&!rl&&r
004
MC/DC0%0/2
exists $ENV{"PERL_USE_UNSAFE_INC"} and defined $ENV{"PERL_USE_UNSAFE_INC"}
exists $ENV{"PERL_USE_UNSAFE_INC"} defined $ENV{"PERL_USE_UNSAFE_INC"}
Truth table33%1/3
A and B
A= exists $ENV{"PERL_USE_UNSAFE_INC"}B= defined $ENV{"PERL_USE_UNSAFE_INC"}
ABresult
0X0
100
111
3693 4 $CPAN::META->set_perl5lib;
3694 4 local $ENV{MAKEFLAGS}; # protect us from outer make calls
3695 4 ▶ local $ENV{PERL_MM_USE_DEFAULT} = 1 if $CPAN::Config->{use_prompt_default};
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::Config->{"use_prompt_default"} 0 4 4
3696 4 ▶ local $ENV{NONINTERACTIVE_TESTING} = 1 if $CPAN::Config->{use_prompt_default};
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::Config->{"use_prompt_default"} 0 4 4
3697  
3698 4 ▶ if ($run_allow_installing_within_test) {
Branch: 1 branch
BranchTrueFalseTotal
if ($run_allow_installing_within_test) 4 0 4
3699 4 my($allow_installing, $why) = $self->_allow_installing;
3700 4 ▶ if (! $allow_installing) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($allow_installing) 0 4 4
3701 0 $CPAN::Frontend->mywarn("Testing/Installation stopped: $why\n");
3702 0 $self->introduce_myself;
3703 0 $self->{make_test} = CPAN::Distrostatus->new("NO -- testing/installation stopped due $why");
3704 0 $CPAN::Frontend->mywarn(" [testing] -- NOT OK\n");
3705 0 delete $self->{force_update};
3706 0 $self->post_test();
3707 0 return;
3708 }
3709 }
3710 4 $CPAN::Frontend->myprint(sprintf "Running %s test for %s\n", $make, $self->pretty_id);
3711  
3712 4 ▶ my $builddir = $self->dir or
Branch: 1 branch
BranchTrueFalseTotal
my $builddir = $self->dir or $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n") 4 0 4
3713 $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n");
3714  
3715 4 ▶ unless (chdir $builddir) {
Branch: 1 branch
BranchTrueFalseTotal
unless (CPAN::Distribution::chdir($builddir)) 0 4 4
3716 0 $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!");
3717 0 $self->post_test();
3718 0 return;
3719 }
3720  
3721 4 ▶ $self->debug("Changed directory to $self->{build_dir}")
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 4 4
3722 if $CPAN::DEBUG;
3723  
3724 4 ▶ if ($self->{modulebuild}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"modulebuild"}) 0 4 4
3725 0 my $thm = CPAN::Shell->expand("Module","Test::Harness");
3726 0 my $v = $thm->inst_version;
3727 0 ▶ if (CPAN::Version->vlt($v,2.62)) {
Branch: 1 branch
BranchTrueFalseTotal
if ("CPAN::Version"->vlt($v, "2.62")) 0 0 0
3728 # XXX Eric Wilhelm reported this as a bug: klapperl:
3729 # Test::Harness 3.0 self-tests, so that should be 'unless
3730 # installing Test::Harness'
3731 0 ▶ unless ($self->id eq $thm->distribution->id) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->id eq $thm->distribution->id) 0 0 0
3732 0 $CPAN::Frontend->mywarn(qq{The version of your Test::Harness is only
3733 '$v', you need at least '2.62'. Please upgrade your Test::Harness.\n});
3734 0 $self->{make_test} = CPAN::Distrostatus->new("NO Test::Harness too old");
3735 0 $self->post_test();
3736 0 return;
3737 }
3738 }
3739 }
3740  
3741 4 ▶ if ( ! $self->{force_update} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"force_update"}) 4 0 4
3742 # bypass actual tests if "trust_test_report_history" and have a report
3743 4 my $have_tested_fcn;
3744 4 ▶ if ( $CPAN::Config->{trust_test_report_history}
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"trust_test_report_history"} and $CPAN::META->has_inst("CPAN::Reporter::History") and $have_tested_fcn = "CPAN::Reporter::History"->can("have_tested")) 0 4 4
Condition33%2/6
$CPAN::Config->{"trust_test_report_history"} and $CPAN::META->has_inst("CPAN::Reporter::History") and $have_tested_fcn = "CPAN::Reporter::History"->can("have_tested")
!ll&&!rl&&r
400
$CPAN::Config->{"trust_test_report_history"} and $CPAN::META->has_inst("CPAN::Reporter::History")
!ll&&!rl&&r
400
MC/DC0%0/3
$CPAN::Config->{"trust_test_report_history"} and $CPAN::META->has_inst("CPAN::Reporter::History") and $have_tested_fcn = "CPAN::Reporter::History"->can("have_tested")
$CPAN::Config->{"trust_test_report_history"} $CPAN::META->has_inst("CPAN::Reporter::History") $have_tested_fcn = "CPAN::Reporter::History"->can("have_tested")
Truth table25%1/4
A and B and C
A= $CPAN::Config->{"trust_test_report_history"}B= $CPAN::META->has_inst("CPAN::Reporter::History")C= $have_tested_fcn = "CPAN::Reporter::History"->can("have_tested")
ABCresult
0XX0
10X0
1100
1111
3745 && $CPAN::META->has_inst("CPAN::Reporter::History")
3746 && ( $have_tested_fcn = CPAN::Reporter::History->can("have_tested" ))) {
3747 0 ▶ if ( my @reports = $have_tested_fcn->( dist => $self->base_id ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@reports) = &$have_tested_fcn("dist", $self->base_id)) 0 0 0
3748 # Do nothing if grade was DISCARD
3749 0 ▶ if ( $reports[-1]->{grade} =~ /^(?:PASS|UNKNOWN)$/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($reports[-1]{'grade'} =~ /^(?:PASS|UNKNOWN)$/) { } 0 0 0
elsif ($reports[-1]{'grade'} =~ /^(?:FAIL|NA)$/) { } 0 0 0
3750 0 $self->{make_test} = CPAN::Distrostatus->new("YES");
3751 # if global "is_tested" has been cleared, we need to mark this to
3752 # be added to PERL5LIB if not already installed
3753 0 ▶ if ($self->tested_ok_but_not_installed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->tested_ok_but_not_installed) 0 0 0
3754 0 $CPAN::META->is_tested($self->{build_dir},$self->{make_test}{TIME});
3755 }
3756 0 $CPAN::Frontend->myprint("Found prior test report -- OK\n");
3757 0 $self->post_test();
3758 0 return;
3759 }
3760 elsif ( $reports[-1]->{grade} =~ /^(?:FAIL|NA)$/ ) {
3761 0 $self->{make_test} = CPAN::Distrostatus->new("NO");
3762 0 $self->{badtestcnt}++;
3763 0 $CPAN::Frontend->mywarn("Found prior test report -- NOT OK\n");
3764 0 $self->post_test();
3765 0 return;
3766 }
3767 }
3768 }
3769 }
3770  
3771 4 my $system;
3772 4 my $prefs_test = $self->prefs->{test};
3773 4 ▶ if (my $commandline
Branch: 3 branches
BranchTrueFalseTotal
if (my $commandline = exists $prefs_test->{'commandline'} ? $prefs_test->{'commandline'} : '') { } 0 4 4
elsif ($self->{'modulebuild'}) { } 0 4 4
exists $prefs_test->{'commandline'} ? : 0 4 4
3774 = exists $prefs_test->{commandline} ? $prefs_test->{commandline} : "") {
3775 0 $system = $commandline;
3776 0 $ENV{PERL} = CPAN::find_perl();
3777 } elsif ($self->{modulebuild}) {
3778 0 $system = sprintf "%s test", $self->_build_command();
3779 0 ▶ unless (-e "Build" || ($^O eq 'VMS' && -e "Build.com")) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-e "Build" or $^O eq "VMS" and -e "Build.com") 0 0 0
Condition0%0/6
-e "Build" or $^O eq "VMS" and -e "Build.com"
l!l&&r!l&&!r
000
$^O eq "VMS" and -e "Build.com"
!ll&&!rl&&r
000
MC/DC0%0/3
-e "Build" or $^O eq "VMS" and -e "Build.com"
-e "Build" $^O eq "VMS" -e "Build.com"
Truth table0%0/4
A or B and C
A= -e "Build"B= $^O eq "VMS"C= -e "Build.com"
ABCresult
1XX1
0111
00X0
0100
3780 0 my $id = $self->pretty_id;
3781 0 $CPAN::Frontend->mywarn("Alert: no 'Build' file found while trying to test '$id'");
3782 }
3783 } else {
3784 4 $system = join " ", $self->_make_command(), "test";
3785 }
3786 4 my $make_test_arg = $self->_make_phase_arg("test");
3787 4 ▶ $system = sprintf("%s%s",
Branch: 1 branch
BranchTrueFalseTotal
$make_test_arg ? : 0 4 4
3788 $system,
3789 $make_test_arg ? " $make_test_arg" : "",
3790 );
3791 4 my($tests_ok);
3792 my $test_env;
3793 4 ▶ if ($self->prefs->{test}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->prefs->{"test"}) 0 4 4
3794 0 $test_env = $self->prefs->{test}{env};
3795 }
3796 4 ▶ local @ENV{keys %$test_env} = values %$test_env if $test_env;
Branch: 1 branch
BranchTrueFalseTotal
if $test_env 0 4 4
3797 4 my $expect_model = $self->_prefs_with_expect("test");
3798 4 my $want_expect = 0;
3799 0 ▶ if ( $expect_model && @{$expect_model->{talk}} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expect_model and @{$expect_model->{"talk"};}) 0 4 4
Condition33%1/3
$expect_model and @{$expect_model->{"talk"};}
!ll&&!rl&&r
400
MC/DC0%0/2
$expect_model and @{$expect_model->{"talk"};}
$expect_model @{$expect_model->{"talk"};}
Truth table33%1/3
A and B
A= $expect_modelB= @{$expect_model->{"talk"};}
ABresult
0X0
100
111
3800 0 my $can_expect = $CPAN::META->has_inst("Expect");
3801 0 ▶ if ($can_expect) {
Branch: 1 branch
BranchTrueFalseTotal
if ($can_expect) { } 0 0 0
3802 0 $want_expect = 1;
3803 } else {
3804 0 $CPAN::Frontend->mywarn("Expect not installed, falling back to ".
3805 "testing without\n");
3806 }
3807 }
3808  
3809 FORK: {
3810 4 my $pid = fork;
3811 4 ▶ if (! defined $pid) { # contention
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $pid) { } 0 4 4
elsif ($pid) { } 2 2 4
3812 0 warn "Contention '$!', sleeping 2";
3813 0 sleep 2;
3814 0 redo FORK;
3815 } elsif ($pid) { # parent
3816 2 ▶ if ($^O eq "MSWin32") {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 2 2
3817 0 wait;
3818 } else {
3819 2 ▶ SUPERVISE: while (waitpid($pid, WNOHANG) <= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (waitpid($pid, 1) <= 0) 15 2 17
3820 15 ▶ if ($CPAN::Signal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Signal) 0 15 15
3821 0 kill 9, -$pid;
3822 }
3823 15 sleep 1;
3824 }
3825 }
3826 2 $tests_ok = !$?;
3827 } else { # child
3828 2 ▶ POSIX::setsid() unless $^O eq "MSWin32";
Branch: 1 branch
BranchTrueFalseTotal
unless $^O eq "MSWin32" 2 0 2
3829 2 my $c_ok;
3830 2 $|=1;
3831 2 ▶ if ($want_expect) {
Branch: 2 branches
BranchTrueFalseTotal
if ($want_expect) { } 0 2 2
elsif ($self->_should_report('test')) { } 0 2 2
3832 0 ▶ if ($self->_should_report('test')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_should_report("test")) 0 0 0
3833 0 $CPAN::Frontend->mywarn("Reporting via CPAN::Reporter is currently ".
3834 "not supported when distroprefs specify ".
3835 "an interactive test\n");
3836 }
3837 0 $c_ok = $self->_run_via_expect($system,'test',$expect_model) == 0;
3838 } elsif ( $self->_should_report('test') ) {
3839 0 $c_ok = CPAN::Reporter::test($self, $system);
3840 } else {
3841 2 $c_ok = system($system) == 0;
3842 }
3843 2 exit !$c_ok;
3844 }
3845 } # FORK
3846  
3847 2 $self->introduce_myself;
3848 2 my $but = $self->_make_test_illuminate_prereqs();
3849 2 ▶ if ( $tests_ok ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tests_ok) { } 1 1 2
3850 1 ▶ if ($but) {
Branch: 1 branch
BranchTrueFalseTotal
if ($but) 0 1 1
3851 0 $CPAN::Frontend->mywarn("Tests succeeded but $but\n");
3852 0 $self->{make_test} = CPAN::Distrostatus->new("NO $but");
3853 0 $self->store_persistent_state;
3854 0 $self->post_test();
3855 0 return $self->goodbye("[dependencies] -- NA");
3856 }
3857 1 $CPAN::Frontend->myprint(" $system -- OK\n");
3858 1 $self->{make_test} = CPAN::Distrostatus->new("YES");
3859 1 $CPAN::META->is_tested($self->{build_dir},$self->{make_test}{TIME});
3860 # probably impossible to need the next line because badtestcnt
3861 # has a lifespan of one command
3862 1 delete $self->{badtestcnt};
3863 } else {
3864 1 ▶ if ($but) {
Branch: 3 branches
BranchTrueFalseTotal
if ($but) { } 0 1 1
elsif ($self->{'force_update'}) { } 0 1 1
elsif ($CPAN::Signal) { } 0 1 1
3865 0 $but .= "; additionally test harness failed";
3866 0 $CPAN::Frontend->mywarn("$but\n");
3867 0 $self->{make_test} = CPAN::Distrostatus->new("NO $but");
3868 } elsif ( $self->{force_update} ) {
3869 0 $self->{make_test} = CPAN::Distrostatus->new(
3870 "NO but failure ignored because 'force' in effect"
3871 );
3872 } elsif ($CPAN::Signal) {
3873 0 $self->{make_test} = CPAN::Distrostatus->new("NO -- Interrupted");
3874 } else {
3875 1 $self->{make_test} = CPAN::Distrostatus->new("NO");
3876 }
3877 1 $self->{badtestcnt}++;
3878 1 $CPAN::Frontend->mywarn(" $system -- NOT OK\n");
3879 1 CPAN::Shell->optprint
3880 ("hint",
3881 sprintf
3882 ("//hint// to see the cpan-testers results for installing this module, try:
3883 reports %s\n",
3884 $self->pretty_id));
3885 }
3886 2 $self->store_persistent_state;
3887  
3888 2 $self->post_test();
3889  
3890 2 ▶ return $self->{force_update} ? 1 : !! $tests_ok;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'force_update'} ? : 0 2 2
3891 }
3892  
3893 2 ▶sub _make_test_illuminate_prereqs {
Subroutine _make_test_illuminate_prereqs: called CC=14 SCAR=48.1
3894 2 my($self) = @_;
3895 2 my @prereq;
3896  
3897 # local $CPAN::DEBUG = 16; # Distribution
3898 2 for my $m (sort keys %{$self->{sponsored_mods}}) {
3899 0 ▶ next unless $self->{sponsored_mods}{$m} > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"sponsored_mods"}{$m} > 0 0 0 0
3900 0 ▶ my $m_obj = CPAN::Shell->expand("Module",$m) or next;
Branch: 1 branch
BranchTrueFalseTotal
my $m_obj = "CPAN::Shell"->expand("Module", $m) or next 0 0 0
3901 # XXX we need available_version which reflects
3902 # $ENV{PERL5LIB} so that already tested but not yet
3903 # installed modules are counted.
3904 0 my $available_version = $m_obj->available_version;
3905 0 my $available_file = $m_obj->available_file;
3906 0 ▶ if ($available_version &&
Branch: 2 branches
BranchTrueFalseTotal
if ($available_version and not 'CPAN::Version'->vlt($available_version, $self->{'prereq_pm'}{$m})) { } 0 0 0
elsif ($available_file and !$self->{'prereq_pm'}{$m} || $self->{'prereq_pm'}{$m} == 0) { } 0 0 0
Condition0%0/3
$available_version and not "CPAN::Version"->vlt($available_version, $self->{"prereq_pm"}{$m})
!ll&&!rl&&r
000
MC/DC0%0/2
$available_version and not "CPAN::Version"->vlt($available_version, $self->{"prereq_pm"}{$m})
$available_version not "CPAN::Version"->vlt($available_version, $self->{"prereq_pm"}{$m})
Truth table0%0/3
A and not(B)
A= $available_versionB= not "CPAN::Version"->vlt($available_version, $self->{"prereq_pm"}{$m})
ABresult
0X0
100
111
3907 !CPAN::Version->vlt($available_version,$self->{prereq_pm}{$m})
3908 ) {
3909 0 ▶ CPAN->debug("m[$m] good enough available_version[$available_version]")
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3910 if $CPAN::DEBUG;
3911 ▶ } elsif ($available_file
Condition0%0/6
$available_file and !$self->{"prereq_pm"}{$m} || $self->{"prereq_pm"}{$m} == 0
!ll&&!rl&&r
000
not $self->{"prereq_pm"}{$m} or $self->{"prereq_pm"}{$m} == 0
l!l&&r!l&&!r
000
MC/DC0%0/3
$available_file and !$self->{"prereq_pm"}{$m} || $self->{"prereq_pm"}{$m} == 0
$available_file not $self->{"prereq_pm"}{$m} $self->{"prereq_pm"}{$m} == 0
Truth table0%0/4
A and not(B) or C
A= $available_fileB= not $self->{"prereq_pm"}{$m}C= $self->{"prereq_pm"}{$m} == 0
ABCresult
0XX0
1000
11X1
1011
3912 && (
3913 !$self->{prereq_pm}{$m}
3914 ||
3915 $self->{prereq_pm}{$m} == 0
3916 )
3917 ) {
3918 # lex Class::Accessor::Chained::Fast which has no $VERSION
3919 0 ▶ CPAN->debug("m[$m] have available_file[$available_file]")
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3920 if $CPAN::DEBUG;
3921 } else {
3922 0 ▶ push @prereq, $m
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_locally_optional(undef, $m) 0 0 0
3923 unless $self->is_locally_optional(undef, $m);
3924 }
3925 }
3926 2 my $but;
3927 2 ▶ if (@prereq) {
Branch: 1 branch
BranchTrueFalseTotal
if (@prereq) 0 2 2
3928 0 my $cnt = @prereq;
3929 0 my $which = join ",", @prereq;
3930 0 ▶ $but = $cnt == 1 ? "one dependency not OK ($which)" :
Branch: 1 branch
BranchTrueFalseTotal
$cnt == 1 ? : 0 0 0
3931 "$cnt dependencies missing ($which)";
3932 }
3933 2 $but;
3934 }
3935  
3936 15 ▶sub _prefs_with_expect {
Subroutine _prefs_with_expect: called CC=5 SCAR=25.2
3937 15 my($self,$where) = @_;
3938 15 ▶ return unless my $prefs = $self->prefs;
Branch: 1 branch
BranchTrueFalseTotal
unless my $prefs = $self->prefs 0 15 15
3939 15 ▶ return unless my $where_prefs = $prefs->{$where};
Branch: 1 branch
BranchTrueFalseTotal
unless my $where_prefs = $prefs->{$where} 15 0 15
3940 0 ▶ if ($where_prefs->{expect}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($where_prefs->{'expect'}) { } 0 0 0
elsif ($where_prefs->{'eexpect'}) { } 0 0 0
3941 return {
3942 mode => "deterministic",
3943 timeout => 15,
3944 talk => $where_prefs->{expect},
3945 0 };
3946 } elsif ($where_prefs->{"eexpect"}) {
3947 0 return $where_prefs->{"eexpect"};
3948 }
3949 0 return;
3950 }
3951  
3952 #-> sub CPAN::Distribution::clean ;
3953 0 ▶sub clean {
Subroutine clean: not called CC=16 SCAR=56.1
Pod undocumented
3954 0 my($self) = @_;
3955 0 ▶ my $make = $self->{modulebuild} ? "Build" : "make";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'modulebuild'} ? : 0 0 0
3956 0 $CPAN::Frontend->myprint(sprintf "Running %s clean for %s\n", $make, $self->pretty_id);
3957 0 ▶ unless (exists $self->{archived}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"archived"}) 0 0 0
3958 0 $CPAN::Frontend->mywarn("Distribution seems to have never been unzipped".
3959 "/untarred, nothing done\n");
3960 0 return 1;
3961 }
3962 0 ▶ unless (exists $self->{build_dir}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"build_dir"}) 0 0 0
3963 0 $CPAN::Frontend->mywarn("Distribution has no own directory, nothing to do.\n");
3964 0 return 1;
3965 }
3966 0 ▶ if (exists $self->{writemakefile}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"writemakefile"} and $self->{"writemakefile"}->failed) 0 0 0
Condition0%0/3
exists $self->{"writemakefile"} and $self->{"writemakefile"}->failed
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"writemakefile"} and $self->{"writemakefile"}->failed
exists $self->{"writemakefile"} $self->{"writemakefile"}->failed
Truth table0%0/3
A and B
A= exists $self->{"writemakefile"}B= $self->{"writemakefile"}->failed
ABresult
0X0
100
111
3967 and $self->{writemakefile}->failed
3968 ) {
3969 0 $CPAN::Frontend->mywarn("No Makefile, don't know how to 'make clean'\n");
3970 0 return 1;
3971 }
3972 EXCUSE: {
3973 0 my @e;
3974 0 ▶ exists $self->{make_clean} and $self->{make_clean} eq "YES" and
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{"make_clean"} and $self->{"make_clean"} eq "YES" and push @e, "make clean already called once" 0 0 0
Condition0%0/3
exists $self->{"make_clean"} and $self->{"make_clean"} eq "YES"
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"make_clean"} and $self->{"make_clean"} eq "YES"
exists $self->{"make_clean"} $self->{"make_clean"} eq "YES"
Truth table0%0/3
A and B
A= exists $self->{"make_clean"}B= $self->{"make_clean"} eq "YES"
ABresult
0X0
100
111
3975 push @e, "make clean already called once";
3976 0 ▶ $CPAN::Frontend->myprint(join "", map {" $_\n"} @e) and return if @e;
Branch: 1 branch
BranchTrueFalseTotal
if @e 0 0 0
Condition0%0/5
@e && ($CPAN::Frontend->myprint(join('', map({" $_\n";} @e))) && (return))
!ll&&!rl&&r
000
$CPAN::Frontend->myprint(join("", map({" $_\n";} @e))) and return
!ll
00
MC/DC0%0/2
@e && ($CPAN::Frontend->myprint(join('', map({" $_\n";} @e))) && (return))
@e $CPAN::Frontend->myprint(join("", map({" $_\n";} @e)))
Truth table0%0/3
A && B
A= @eB= $CPAN::Frontend->myprint(join("", map({" $_\n";} @e)))
ABresult
0X0
100
111
3977 }
3978 0 ▶ chdir "$self->{build_dir}" or
Branch: 1 branch
BranchTrueFalseTotal
CPAN::Distribution::chdir(qq[$self->{"build_dir"}]) or Carp::confess(qq[Couldn't chdir to $self->{"build_dir"}: $!]) 0 0 0
3979 Carp::confess("Couldn't chdir to $self->{build_dir}: $!");
3980 0 ▶ $self->debug("Changed directory to $self->{build_dir}") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3981  
3982 0 my $system;
3983 0 ▶ if ($self->{modulebuild}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'modulebuild'}) { } 0 0 0
3984 0 ▶ unless (-f "Build") {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f "Build") 0 0 0
3985 0 my $cwd = CPAN::anycwd();
3986 0 $CPAN::Frontend->mywarn("Alert: no Build file available for 'clean $self->{id}".
3987 " in cwd[$cwd]. Danger, Will Robinson!");
3988 0 $CPAN::Frontend->mysleep(5);
3989 }
3990 0 $system = sprintf "%s clean", $self->_build_command();
3991 } else {
3992 0 $system = join " ", $self->_make_command(), "clean";
3993 }
3994 0 my $system_ok = system($system) == 0;
3995 0 $self->introduce_myself;
3996 0 ▶ if ( $system_ok ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($system_ok) { } 0 0 0
3997 0 $CPAN::Frontend->myprint(" $system -- OK\n");
3998  
3999 # $self->force;
4000  
4001 # Jost Krieger pointed out that this "force" was wrong because
4002 # it has the effect that the next "install" on this distribution
4003 # will untar everything again. Instead we should bring the
4004 # object's state back to where it is after untarring.
4005  
4006 0 for my $k (qw(
4007 force_update
4008 install
4009 writemakefile
4010 make
4011 make_test
4012 )) {
4013 0 delete $self->{$k};
4014 }
4015 0 $self->{make_clean} = CPAN::Distrostatus->new("YES");
4016  
4017 } else {
4018 # Hmmm, what to do if make clean failed?
4019  
4020 0 $self->{make_clean} = CPAN::Distrostatus->new("NO");
4021 0 $CPAN::Frontend->mywarn(qq{ $system -- NOT OK\n});
4022  
4023 # 2006-02-27: seems silly to me to force a make now
4024 # $self->force("make"); # so that this directory won't be used again
4025  
4026 }
4027 0 $self->store_persistent_state;
4028 }
4029  
4030 #-> sub CPAN::Distribution::check_disabled ;
4031 7 ▶sub check_disabled {
Subroutine check_disabled: called CC=4 SCAR=16.4
Pod undocumented
4032 7 my ($self) = @_;
4033 7 ▶ $self->debug("checking disabled id[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
4034 7 ▶ if ($self->prefs->{disabled} && ! $self->{force_update}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->prefs->{"disabled"} and not $self->{"force_update"}) 0 7 7
Condition33%1/3
$self->prefs->{"disabled"} and not $self->{"force_update"}
!ll&&!rl&&r
700
MC/DC0%0/2
$self->prefs->{"disabled"} and not $self->{"force_update"}
$self->prefs->{"disabled"} not $self->{"force_update"}
Truth table33%1/3
A and not(B)
A= $self->prefs->{"disabled"}B= not $self->{"force_update"}
ABresult
0X0
100
111
4035 return sprintf(
4036 "Disabled via prefs file '%s' doc %d",
4037 $self->{prefs_file},
4038 $self->{prefs_file_doc},
4039 0 );
4040 }
4041 7 return;
4042 }
4043  
4044 #-> sub CPAN::Distribution::goto ;
4045 0 ▶sub goto {
Subroutine goto: not called CC=4 SCAR=30.0
Pod undocumented
4046 0 my($self,$goto) = @_;
4047 0 $goto = $self->normalize($goto);
4048 my $why = sprintf(
4049 "Goto '$goto' via prefs file '%s' doc %d",
4050 $self->{prefs_file},
4051 $self->{prefs_file_doc},
4052 0 );
4053 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO $why");
4054 # 2007-07-16 akoenig : Better than NA would be if we could inherit
4055 # the status of the $goto distro but given the exceptional nature
4056 # of 'goto' I feel reluctant to implement it
4057 0 my $goodbye_message = "[goto] -- NA $why";
4058 0 $self->goodbye($goodbye_message);
4059  
4060 # inject into the queue
4061  
4062 0 CPAN::Queue->delete($self->id);
4063 0 CPAN::Queue->jumpqueue({qmod => $goto, reqtype => $self->{reqtype}});
4064  
4065 # and run where we left off
4066  
4067 0 my($method) = (caller(1))[3];
4068 0 my $goto_do = CPAN->instance("CPAN::Distribution",$goto);
4069 0 ▶ $goto_do->called_for($self->called_for) unless $goto_do->called_for;
Branch: 1 branch
BranchTrueFalseTotal
unless $goto_do->called_for 0 0 0
4070 0 ▶ $goto_do->{mandatory} ||= $self->{mandatory};
Condition0%0/3
$goto_do->{"mandatory"} ||= $self->{"mandatory"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$goto_do->{"mandatory"} ||= $self->{"mandatory"}
$goto_do->{"mandatory"} $self->{"mandatory"}
Truth table0%0/3
A ||= B
A= $goto_do->{"mandatory"}B= $self->{"mandatory"}
ABresult
1X1
011
000
4071 0 ▶ $goto_do->{reqtype} ||= $self->{reqtype};
Condition0%0/3
$goto_do->{"reqtype"} ||= $self->{"reqtype"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$goto_do->{"reqtype"} ||= $self->{"reqtype"}
$goto_do->{"reqtype"} $self->{"reqtype"}
Truth table0%0/3
A ||= B
A= $goto_do->{"reqtype"}B= $self->{"reqtype"}
ABresult
1X1
011
000
4072 0 $goto_do->{coming_from} = $self->pretty_id;
4073 0 $goto_do->$method();
4074 0 CPAN::Queue->delete_first($goto);
4075 # XXX delete_first returns undef; is that what this should return
4076 # up the call stack, eg. return $sefl->goto($goto) -- xdg, 2012-04-04
4077 }
4078  
4079 #-> sub CPAN::Distribution::shortcut_install ;
4080 # return values: undef means don't shortcut; 0 means shortcut as fail;
4081 # and 1 means shortcut as success
4082 1 ▶sub shortcut_install {
Subroutine shortcut_install: called CC=8 SCAR=31.6
Pod undocumented
4083 1 my ($self) = @_;
4084  
4085 1 ▶ $self->debug("checking previous install results[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 1 1
4086 1 ▶ if (exists $self->{install}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"install"}) 0 1 1
4087 my $text = UNIVERSAL::can($self->{install},"text") ?
4088 $self->{install}->text :
4089 0 ▶ $self->{install};
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::can($self->{'install'}, 'text') ? : 0 0 0
4090 0 ▶ if ($text =~ /^YES/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($text =~ /^YES/) { } 0 0 0
elsif ($text =~ /is only/) { } 0 0 0
4091 0 $CPAN::META->is_installed($self->{build_dir});
4092 0 return $self->success("Already done");
4093 } elsif ($text =~ /is only/) {
4094 # e.g. 'is only build_requires': may be overruled later
4095 0 return $self->goodbye($text);
4096 } else {
4097 # comment in Todo on 2006-02-11; maybe retry?
4098 0 return $self->goodbye("Already tried without success");
4099 }
4100 }
4101  
4102 1 for my $slot ( qw/later configure_requires_later/ ) {
4103 return $self->success($self->{$slot})
4104 2 ▶ if $self->{$slot};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{$slot} 0 2 2
4105 }
4106  
4107 1 return undef;
4108 }
4109  
4110 #-> sub CPAN::Distribution::is_being_sponsored ;
4111  
4112 # returns true if we find a distro object in the queue that has
4113 # sponsored this one
4114 0 ▶sub is_being_sponsored {
Subroutine is_being_sponsored: not called CC=7 SCAR=40.3
Pod undocumented
4115 0 my($self) = @_;
4116 0 my $iterator = CPAN::Queue->iterator;
4117 0 ▶ QITEM: while (my $q = $iterator->()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $q = &$iterator()) 0 0 0
4118 0 my $s = $q->as_string;
4119 0 ▶ my $obj = CPAN::Shell->expandany($s) or next QITEM;
Branch: 1 branch
BranchTrueFalseTotal
my $obj = "CPAN::Shell"->expandany($s) or next QITEM 0 0 0
4120 0 my $type = ref $obj;
4121 0 ▶ if ( $type eq 'CPAN::Distribution' ){
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "CPAN::Distribution") 0 0 0
4122 0 ▶ for my $module (sort keys %{$obj->{sponsored_mods} || {}}) {
Condition0%0/2
$obj->{'sponsored_mods'} || {}
l!l
00
MC/DC0%0/1
$obj->{'sponsored_mods'} || {}
$obj->{'sponsored_mods'}
Truth table0%0/2
A
A= $obj->{'sponsored_mods'}
Aresult
11
00
4123 0 ▶ return 1 if grep { $_ eq $module } $self->containsmods;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$_ eq $module;} $self->containsmods 0 0 0
4124 }
4125 }
4126 }
4127 0 return 0;
4128 }
4129  
4130 #-> sub CPAN::Distribution::install ;
4131 7 ▶sub install {
Subroutine install: called CC=50 SCAR=62.7
Pod undocumented
4132 7 my($self) = @_;
4133  
4134 7 $self->pre_install();
4135  
4136 7 ▶ if (exists $self->{cleanup_after_install_done}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"cleanup_after_install_done"}) 0 7 7
4137 0 return $self->test;
4138 }
4139  
4140 7 ▶ $self->debug("checking goto id[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
4141 7 ▶ if (my $goto = $self->prefs->{goto}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $goto = $self->prefs->{"goto"}) 0 7 7
4142 0 $self->goto($goto);
4143 0 $self->post_install();
4144 0 return;
4145 }
4146  
4147 7 ▶ unless ($self->test) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->test) 4 1 5
4148 4 $self->post_install();
4149 4 return;
4150 }
4151  
4152 1 ▶ if ( defined( my $sc = $self->shortcut_install ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $sc = $self->shortcut_install)) 0 1 1
4153 0 $self->post_install();
4154 0 return $sc;
4155 }
4156  
4157 1 ▶ if ($CPAN::Signal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Signal) 0 1 1
4158 0 delete $self->{force_update};
4159 0 $self->post_install();
4160 0 return;
4161 }
4162  
4163 1 ▶ my $builddir = $self->dir or
Branch: 1 branch
BranchTrueFalseTotal
my $builddir = $self->dir or $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n") 1 0 1
4164 $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n");
4165  
4166 1 ▶ unless (chdir $builddir) {
Branch: 1 branch
BranchTrueFalseTotal
unless (CPAN::Distribution::chdir($builddir)) 0 1 1
4167 0 $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!");
4168 0 $self->post_install();
4169 0 return;
4170 }
4171  
4172 1 ▶ $self->debug("Changed directory to $self->{build_dir}")
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 1 1
4173 if $CPAN::DEBUG;
4174  
4175 1 ▶ my $make = $self->{modulebuild} ? "Build" : "make";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'modulebuild'} ? : 0 1 1
4176 1 $CPAN::Frontend->myprint(sprintf "Running %s install for %s\n", $make, $self->pretty_id);
4177  
4178 1 my $system;
4179 1 ▶ if (my $commandline = $self->prefs->{install}{commandline}) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $commandline = $self->prefs->{'install'}{'commandline'}) { } 0 1 1
elsif ($self->{'modulebuild'}) { } 0 1 1
4180 0 $system = $commandline;
4181 0 $ENV{PERL} = CPAN::find_perl();
4182 } elsif ($self->{modulebuild}) {
4183 my($mbuild_install_build_command) =
4184 exists $CPAN::HandleConfig::keys{mbuild_install_build_command} &&
4185 $CPAN::Config->{mbuild_install_build_command} ?
4186 $CPAN::Config->{mbuild_install_build_command} :
4187 0 ▶ $self->_build_command();
Branch: 1 branch
BranchTrueFalseTotal
exists $CPAN::HandleConfig::keys{'mbuild_install_build_command'} && $CPAN::Config->{'mbuild_install_build_command'} ? : 0 0 0
Condition0%0/3
exists $CPAN::HandleConfig::keys{"mbuild_install_build_command"} and $CPAN::Config->{"mbuild_install_build_command"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $CPAN::HandleConfig::keys{"mbuild_install_build_command"} and $CPAN::Config->{"mbuild_install_build_command"}
exists $CPAN::HandleConfig::keys{"mbuild_install_build_command"} $CPAN::Config->{"mbuild_install_build_command"}
Truth table0%0/3
A and B
A= exists $CPAN::HandleConfig::keys{"mbuild_install_build_command"}B= $CPAN::Config->{"mbuild_install_build_command"}
ABresult
0X0
100
111
4188 0 ▶ my $install_directive = $^O eq 'VMS' ? '"install"' : 'install';
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'VMS' ? : 0 0 0
4189 $system = sprintf("%s %s %s",
4190 $mbuild_install_build_command,
4191 $install_directive,
4192 $CPAN::Config->{mbuild_install_arg},
4193 0 );
4194 } else {
4195 1 my($make_install_make_command) = $self->_make_install_make_command();
4196 $system = sprintf("%s install %s",
4197 $make_install_make_command,
4198 $CPAN::Config->{make_install_arg},
4199 1 );
4200 }
4201  
4202 1 ▶ my($stderr) = $^O eq "MSWin32" || $^O eq 'VMS' ? "" : " 2>&1 ";
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'MSWin32' || $^O eq 'VMS' ? : 0 1 1
Condition33%1/3
$^O eq "MSWin32" or $^O eq "VMS"
l!l&&r!l&&!r
001
MC/DC0%0/2
$^O eq "MSWin32" or $^O eq "VMS"
$^O eq "MSWin32" $^O eq "VMS"
Truth table33%1/3
A or B
A= $^O eq "MSWin32"B= $^O eq "VMS"
ABresult
1X1
011
000
4203 1 my $brip = CPAN::HandleConfig->prefs_lookup($self,
4204 q{build_requires_install_policy});
4205 1 ▶ $brip ||="ask/yes";
Condition50%1/2
$brip ||= "ask/yes"
l!l
01
MC/DC0%0/1
$brip ||= "ask/yes"
$brip
Truth table50%1/2
A
A= $brip
Aresult
11
00
4206 1 my $id = $self->id;
4207 1 ▶ my $reqtype = $self->{reqtype} ||= "c"; # in doubt it was a command
Condition50%1/2
$self->{"reqtype"} ||= "c"
l!l
10
MC/DC0%0/1
$self->{"reqtype"} ||= "c"
$self->{"reqtype"}
Truth table50%1/2
A
A= $self->{"reqtype"}
Aresult
11
00
4208 1 my $want_install = "yes";
4209 1 ▶ if ($reqtype eq "b") {
Branch: 1 branch
BranchTrueFalseTotal
if ($reqtype eq "b") 0 1 1
4210 0 ▶ if ($brip eq "no") {
Branch: 2 branches
BranchTrueFalseTotal
if ($brip eq 'no') { } 0 0 0
elsif ($brip =~ m[^ask/(.+)]) { } 0 0 0
4211 0 $want_install = "no";
4212 } elsif ($brip =~ m|^ask/(.+)|) {
4213 0 my $default = $1;
4214 0 ▶ $default = "yes" unless $default =~ /^(y|n)/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $default =~ /^(y|n)/i 0 0 0
4215 0 $want_install =
4216 CPAN::Shell::colorable_makemaker_prompt
4217 ("$id is just needed temporarily during building or testing. ".
4218 "Do you want to install it permanently?",
4219 $default);
4220 }
4221 }
4222 1 ▶ unless ($want_install =~ /^y/i) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($want_install =~ /^y/i) 0 1 1
4223 0 my $is_only = "is only 'build_requires'";
4224 0 $self->{install} = CPAN::Distrostatus->new("NO -- $is_only");
4225 0 delete $self->{force_update};
4226 0 $self->goodbye("Not installing because $is_only");
4227 0 $self->post_install();
4228 0 return;
4229 }
4230 local $ENV{PERL5LIB} = defined($ENV{PERL5LIB})
4231 ? $ENV{PERL5LIB}
4232 1 ▶ : ($ENV{PERLLIB} || "");
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL5LIB'} ? : 1 0 1
Condition0%0/2
$ENV{"PERLLIB"} or ""
l!l
00
MC/DC0%0/1
$ENV{"PERLLIB"} or ""
$ENV{"PERLLIB"}
Truth table0%0/2
A
A= $ENV{"PERLLIB"}
Aresult
11
00
4233  
4234 1 ▶ local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : "";
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL5OPT'} ? : 1 0 1
4235 local $ENV{PERL_USE_UNSAFE_INC} =
4236 exists $ENV{PERL_USE_UNSAFE_INC} && defined $ENV{PERL_USE_UNSAFE_INC}
4237 1 ▶ ? $ENV{PERL_USE_UNSAFE_INC} : 1; # install
Branch: 1 branch
BranchTrueFalseTotal
exists $ENV{'PERL_USE_UNSAFE_INC'} && defined $ENV{'PERL_USE_UNSAFE_INC'} ? : 1 0 1
Condition33%1/3
exists $ENV{"PERL_USE_UNSAFE_INC"} and defined $ENV{"PERL_USE_UNSAFE_INC"}
!ll&&!rl&&r
001
MC/DC0%0/2
exists $ENV{"PERL_USE_UNSAFE_INC"} and defined $ENV{"PERL_USE_UNSAFE_INC"}
exists $ENV{"PERL_USE_UNSAFE_INC"} defined $ENV{"PERL_USE_UNSAFE_INC"}
Truth table33%1/3
A and B
A= exists $ENV{"PERL_USE_UNSAFE_INC"}B= defined $ENV{"PERL_USE_UNSAFE_INC"}
ABresult
0X0
100
111
4238 1 $CPAN::META->set_perl5lib;
4239 1 ▶ local $ENV{PERL_MM_USE_DEFAULT} = 1 if $CPAN::Config->{use_prompt_default};
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::Config->{"use_prompt_default"} 0 1 1
4240 1 ▶ local $ENV{NONINTERACTIVE_TESTING} = 1 if $CPAN::Config->{use_prompt_default};
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::Config->{"use_prompt_default"} 0 1 1
4241  
4242 1 my $install_env;
4243 1 ▶ if ($self->prefs->{install}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->prefs->{"install"}) 1 0 1
4244 1 $install_env = $self->prefs->{install}{env};
4245 }
4246 1 ▶ local @ENV{keys %$install_env} = values %$install_env if $install_env;
Branch: 1 branch
BranchTrueFalseTotal
if $install_env 0 1 1
4247  
4248 1 ▶ if (! $run_allow_installing_within_test) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($run_allow_installing_within_test) 0 1 1
4249 0 my($allow_installing, $why) = $self->_allow_installing;
4250 0 ▶ if (! $allow_installing) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($allow_installing) 0 0 0
4251 0 $CPAN::Frontend->mywarn("Installation stopped: $why\n");
4252 0 $self->introduce_myself;
4253 0 $self->{install} = CPAN::Distrostatus->new("NO -- installation stopped due $why");
4254 0 $CPAN::Frontend->mywarn(" $system -- NOT OK\n");
4255 0 delete $self->{force_update};
4256 0 $self->post_install();
4257 0 return;
4258 }
4259 }
4260 1 my($pipe) = FileHandle->new("$system $stderr |");
4261 1 ▶ unless ($pipe) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($pipe) 0 1 1
4262 0 $CPAN::Frontend->mywarn("Can't execute $system: $!");
4263 0 $self->introduce_myself;
4264 0 $self->{install} = CPAN::Distrostatus->new("NO");
4265 0 $CPAN::Frontend->mywarn(" $system -- NOT OK\n");
4266 0 delete $self->{force_update};
4267 0 $self->post_install();
4268 0 return;
4269 }
4270 1 my($makeout) = "";
4271 1 ▶ while (<$pipe>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $pipe)) 6 1 7
4272 6 print $_; # intentionally NOT use Frontend->myprint because it
4273 # looks irritating when we markup in color what we
4274 # just pass through from an external program
4275 6 $makeout .= $_;
4276 }
4277 1 $pipe->close;
4278 1 my $close_ok = $? == 0;
4279 1 $self->introduce_myself;
4280 1 ▶ if ( $close_ok ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($close_ok) { } 1 0 1
4281 1 $CPAN::Frontend->myprint(" $system -- OK\n");
4282 1 $CPAN::META->is_installed($self->{build_dir});
4283 1 $self->{install} = CPAN::Distrostatus->new("YES");
4284 1 ▶ if ($CPAN::Config->{'cleanup_after_install'}
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"cleanup_after_install"} and not $self->is_dot_dist and not $self->is_being_sponsored) 0 1 1
Condition33%2/6
$CPAN::Config->{"cleanup_after_install"} and not $self->is_dot_dist and not $self->is_being_sponsored
!ll&&!rl&&r
100
$CPAN::Config->{"cleanup_after_install"} and not $self->is_dot_dist
!ll&&!rl&&r
100
MC/DC0%0/3
$CPAN::Config->{"cleanup_after_install"} and not $self->is_dot_dist and not $self->is_being_sponsored
$CPAN::Config->{"cleanup_after_install"} not $self->is_dot_dist not $self->is_being_sponsored
Truth table25%1/4
A and not(B) and not(C)
A= $CPAN::Config->{"cleanup_after_install"}B= not $self->is_dot_distC= not $self->is_being_sponsored
ABCresult
0XX0
10X0
1100
1111
4285 && ! $self->is_dot_dist
4286 && ! $self->is_being_sponsored) {
4287 0 my $parent = File::Spec->catdir( $self->{build_dir}, File::Spec->updir );
4288 0 ▶ chdir $parent or $CPAN::Frontend->mydie("Couldn't chdir to $parent: $!\n");
Branch: 1 branch
BranchTrueFalseTotal
CPAN::Distribution::chdir($parent) or $CPAN::Frontend->mydie("Couldn't chdir to ${parent}: $!\n") 0 0 0
4289 0 File::Path::rmtree($self->{build_dir});
4290 0 my $yml = "$self->{build_dir}.yml";
4291 0 ▶ if (-e $yml) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $yml) 0 0 0
4292 0 ▶ unlink $yml or $CPAN::Frontend->mydie("Couldn't unlink $yml: $!\n");
Branch: 1 branch
BranchTrueFalseTotal
unlink $yml or $CPAN::Frontend->mydie("Couldn't unlink ${yml}: $!\n") 0 0 0
4293 }
4294 0 $self->{cleanup_after_install_done}=1;
4295 }
4296 } else {
4297 0 $self->{install} = CPAN::Distrostatus->new("NO");
4298 0 $CPAN::Frontend->mywarn(" $system -- NOT OK\n");
4299 0 my $mimc =
4300 CPAN::HandleConfig->prefs_lookup($self,
4301 q{make_install_make_command});
4302 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($makeout =~ /permission/s and $> > 0 and !$mimc || $mimc eq "CPAN::HandleConfig"->prefs_lookup($self, "make")) 0 0 0
Condition0%0/9
$makeout =~ /permission/s and $> > 0 and !$mimc || $mimc eq "CPAN::HandleConfig"->prefs_lookup($self, "make")
!ll&&!rl&&r
000
$makeout =~ /permission/s and $> > 0
!ll&&!rl&&r
000
not $mimc or $mimc eq "CPAN::HandleConfig"->prefs_lookup($self, "make")
l!l&&r!l&&!r
000
MC/DC0%0/4
$makeout =~ /permission/s and $> > 0 and !$mimc || $mimc eq "CPAN::HandleConfig"->prefs_lookup($self, "make")
$makeout =~ /permission/s $> > 0 not $mimc $mimc eq "CPAN::HandleConfig"->prefs_lookup($self, "make")
Truth table0%0/5
A and B and not(C) or D
A= $makeout =~ /permission/sB= $> > 0C= not $mimcD= $mimc eq "CPAN::HandleConfig"->prefs_lookup($self, "make")
ABCDresult
0XXX0
10XX0
11000
111X1
11011
4303 $makeout =~ /permission/s
4304 && $> > 0
4305 && (
4306 ! $mimc
4307 || $mimc eq (CPAN::HandleConfig->prefs_lookup($self,
4308 q{make}))
4309 )
4310 ) {
4311 0 $CPAN::Frontend->myprint(
4312 qq{----\n}.
4313 qq{ You may have to su }.
4314 qq{to root to install the package\n}.
4315 qq{ (Or you may want to run something like\n}.
4316 qq{ o conf make_install_make_command 'sudo make'\n}.
4317 qq{ to raise your permissions.}
4318 );
4319 }
4320 }
4321 1 delete $self->{force_update};
4322 1 ▶ unless ($CPAN::Config->{'cleanup_after_install'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::Config->{"cleanup_after_install"}) 1 0 1
4323 1 $self->store_persistent_state;
4324 }
4325  
4326 1 $self->post_install();
4327  
4328 1 return !! $close_ok;
4329 }
4330  
4331 0 ▶sub blib_pm_walk {
Subroutine blib_pm_walk: not called CC=1 SCAR=6.9
Pod undocumented
4332 0 my @queue = grep { -e $_ } File::Spec->catdir("blib","lib"), File::Spec->catdir("blib","arch");
4333 0 ▶ return sub {
Subroutine __ANON__: not called CC=9 SCAR=45.0
4334 LOOP: {
4335 0 ▶ if (@queue) {
Branch: 1 branch
BranchTrueFalseTotal
if (@queue) { } 0 0 0
4336 0 my $file = shift @queue;
4337 0 ▶ if (-d $file) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $file) { } 0 0 0
4338 0 my $dh;
4339 0 ▶ opendir $dh, $file or next;
Branch: 1 branch
BranchTrueFalseTotal
opendir $dh, $file or next 0 0 0
4340 my @newfiles = map {
4341 0 my @ret;
4342 0 my $maybedir = File::Spec->catdir($file, $_);
4343 0 ▶ if (-d $maybedir) {
Branch: 2 branches
BranchTrueFalseTotal
if (-d $maybedir) { } 0 0 0
elsif (/\.pm$/) { } 0 0 0
4344 0 ▶ unless (File::Spec->catdir("blib","arch","auto") eq $maybedir) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("File::Spec"->catdir("blib", "arch", "auto") eq $maybedir) 0 0 0
4345 # prune the blib/arch/auto directory, no pm files there
4346 0 @ret = $maybedir;
4347 }
4348 } elsif (/\.pm$/) {
4349 0 my $mustbefile = File::Spec->catfile($file, $_);
4350 0 ▶ if (-f $mustbefile) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $mustbefile) 0 0 0
4351 0 @ret = $mustbefile;
4352 }
4353 }
4354 0 @ret;
4355 } grep {
4356 0 ▶ $_ ne "."
Condition0%0/3
$_ ne '.' && $_ ne '..'
!ll&&!rl&&r
000
MC/DC0%0/2
$_ ne '.' && $_ ne '..'
$_ ne '.' $_ ne '..'
Truth table0%0/3
A && B
A= $_ ne '.'B= $_ ne '..'
ABresult
0X0
100
111
4357 && $_ ne ".."
4358 } readdir $dh;
4359 0 push @queue, @newfiles;
4360 0 redo LOOP;
4361 } else {
4362 0 return $file;
4363 }
4364 } else {
4365 0 return;
4366 }
4367 }
4368 0 };
4369 }
4370  
4371 4 ▶sub _allow_installing {
Subroutine _allow_installing: called CC=35 SCAR=68.4
4372 4 my($self) = @_;
4373 4 my $id = my $pretty_id = $self->pretty_id;
4374 4 ▶ if ($self->{CALLED_FOR}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"CALLED_FOR"}) 4 0 4
4375 4 $id .= " (called for $self->{CALLED_FOR})";
4376 }
4377 4 my $allow_down = CPAN::HandleConfig->prefs_lookup($self,q{allow_installing_module_downgrades});
4378 4 ▶ $allow_down ||= "ask/yes";
Condition50%1/2
$allow_down ||= "ask/yes"
l!l
40
MC/DC0%0/1
$allow_down ||= "ask/yes"
$allow_down
Truth table50%1/2
A
A= $allow_down
Aresult
11
00
4379 4 my $allow_outdd = CPAN::HandleConfig->prefs_lookup($self,q{allow_installing_outdated_dists});
4380 4 ▶ $allow_outdd ||= "ask/yes";
Condition50%1/2
$allow_outdd ||= "ask/yes"
l!l
40
MC/DC0%0/1
$allow_outdd ||= "ask/yes"
$allow_outdd
Truth table50%1/2
A
A= $allow_outdd
Aresult
11
00
4381 4 ▶ return 1 if
Branch: 1 branch
BranchTrueFalseTotal
if $allow_down eq "yes" and $allow_outdd eq "yes" 4 0 4
Condition33%1/3
$allow_down eq "yes" and $allow_outdd eq "yes"
!ll&&!rl&&r
004
MC/DC0%0/2
$allow_down eq "yes" and $allow_outdd eq "yes"
$allow_down eq "yes" $allow_outdd eq "yes"
Truth table33%1/3
A and B
A= $allow_down eq "yes"B= $allow_outdd eq "yes"
ABresult
0X0
100
111
4382 $allow_down eq "yes"
4383 && $allow_outdd eq "yes";
4384 0 ▶ if (($allow_outdd ne "yes") && ! $CPAN::META->has_inst('CPAN::DistnameInfo')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($allow_outdd ne "yes" and not $CPAN::META->has_inst("CPAN::DistnameInfo")) 0 0 0
Condition0%0/3
$allow_outdd ne "yes" and not $CPAN::META->has_inst("CPAN::DistnameInfo")
!ll&&!rl&&r
000
MC/DC0%0/2
$allow_outdd ne "yes" and not $CPAN::META->has_inst("CPAN::DistnameInfo")
$allow_outdd ne "yes" not $CPAN::META->has_inst("CPAN::DistnameInfo")
Truth table0%0/3
A and not(B)
A= $allow_outdd ne "yes"B= not $CPAN::META->has_inst("CPAN::DistnameInfo")
ABresult
0X0
100
111
4385 0 ▶ return 1 if grep { $_ eq 'CPAN::DistnameInfo'} $self->containsmods;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$_ eq "CPAN::DistnameInfo";} $self->containsmods 0 0 0
4386 0 ▶ if ($allow_outdd ne "yes") {
Branch: 1 branch
BranchTrueFalseTotal
if ($allow_outdd ne "yes") 0 0 0
4387 0 $CPAN::Frontend->mywarn("The current configuration of allow_installing_outdated_dists is '$allow_outdd', but for this option we would need 'CPAN::DistnameInfo' installed. Please install 'CPAN::DistnameInfo' as soon as possible. As long as we are not equipped with 'CPAN::DistnameInfo' this option does not take effect\n");
4388 0 $allow_outdd = "yes";
4389 }
4390 }
4391 0 ▶ return 1 if
Branch: 1 branch
BranchTrueFalseTotal
if $allow_down eq "yes" and $allow_outdd eq "yes" 0 0 0
Condition0%0/3
$allow_down eq "yes" and $allow_outdd eq "yes"
!ll&&!rl&&r
000
MC/DC0%0/2
$allow_down eq "yes" and $allow_outdd eq "yes"
$allow_down eq "yes" $allow_outdd eq "yes"
Truth table0%0/3
A and B
A= $allow_down eq "yes"B= $allow_outdd eq "yes"
ABresult
0X0
100
111
4392 $allow_down eq "yes"
4393 && $allow_outdd eq "yes";
4394 0 my($dist_version, $dist_dist);
4395 0 ▶ if ($allow_outdd ne "yes"){
Branch: 1 branch
BranchTrueFalseTotal
if ($allow_outdd ne "yes") 0 0 0
4396 0 my $dni = CPAN::DistnameInfo->new($pretty_id);
4397 0 $dist_version = $dni->version;
4398 0 $dist_dist = $dni->dist;
4399 }
4400 0 my $iterator = blib_pm_walk();
4401 0 my(@down,@outdd);
4402 0 ▶ while (my $file = $iterator->()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $file = &$iterator()) 0 0 0
4403 0 my $version = CPAN::Module->parse_version($file);
4404 0 my($volume, $directories, $pmfile) = File::Spec->splitpath( $file );
4405 0 my @dirs = File::Spec->splitdir( $directories );
4406 0 my(@blib_plus1) = splice @dirs, 0, 2;
4407 0 my($pmpath) = File::Spec->catfile(grep { length($_) } @dirs, $pmfile);
4408 0 ▶ unless ($allow_down eq "yes") {
Branch: 1 branch
BranchTrueFalseTotal
unless ($allow_down eq "yes") 0 0 0
4409 0 ▶ if (my $inst_file = $self->_file_in_path($pmpath, \@INC)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $inst_file = $self->_file_in_path($pmpath, \@INC)) 0 0 0
4410 0 my $inst_version = CPAN::Module->parse_version($inst_file);
4411 0 my $cmp = CPAN::Version->vcmp($version, $inst_version);
4412 0 ▶ if ($cmp) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmp) 0 0 0
4413 0 ▶ if ($cmp < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmp < 0) 0 0 0
4414 0 push @down, { pmpath => $pmpath, version => $version, inst_version => $inst_version };
4415 }
4416 }
4417 0 ▶ if (@down) {
Branch: 1 branch
BranchTrueFalseTotal
if (@down) 0 0 0
4418 0 my $why = "allow_installing_module_downgrades: $id contains downgrading module(s) (e.g. '$down[0]{pmpath}' would downgrade installed '$down[0]{inst_version}' to '$down[0]{version}')";
4419 0 ▶ if (my($default) = $allow_down =~ m|^ask/(.+)|) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($default) = $allow_down =~ m[^ask/(.+)]) 0 0 0
4420 0 ▶ $default = "yes" unless $default =~ /^(y|n)/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $default =~ /^(y|n)/i 0 0 0
4421 0 my $answer = CPAN::Shell::colorable_makemaker_prompt
4422 ("$why. Do you want to allow installing it?",
4423 $default, "colorize_warn");
4424 0 ▶ $allow_down = $answer =~ /^\s*y/i ? "yes" : "no";
Branch: 1 branch
BranchTrueFalseTotal
$answer =~ /^\s*y/i ? : 0 0 0
4425 }
4426 0 ▶ if ($allow_down eq "no") {
Branch: 1 branch
BranchTrueFalseTotal
if ($allow_down eq "no") 0 0 0
4427 0 return (0, $why);
4428 }
4429 }
4430 }
4431 }
4432 0 ▶ unless ($allow_outdd eq "yes") {
Branch: 1 branch
BranchTrueFalseTotal
unless ($allow_outdd eq "yes") 0 0 0
4433 0 my @pmpath = (@dirs, $pmfile);
4434 0 $pmpath[-1] =~ s/\.pm$//;
4435 0 my $mo = CPAN::Shell->expand("Module",join "::", grep { length($_) } @pmpath);
4436 0 ▶ if ($mo) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mo) 0 0 0
4437 0 my $cpan_version = $mo->cpan_version;
4438 0 my $is_lower = CPAN::Version->vlt($version, $cpan_version);
4439 0 my $other_dist;
4440 0 ▶ if (my $mo_dist = $mo->distribution) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $mo_dist = $mo->distribution) 0 0 0
4441 0 $other_dist = $mo_dist->pretty_id;
4442 0 my $dni = CPAN::DistnameInfo->new($other_dist);
4443 0 ▶ if ($dni->dist eq $dist_dist){
Branch: 1 branch
BranchTrueFalseTotal
if ($dni->dist eq $dist_dist) 0 0 0
4444 0 ▶ if (CPAN::Version->vgt($dni->version, $dist_version)) {
Branch: 1 branch
BranchTrueFalseTotal
if ("CPAN::Version"->vgt($dni->version, $dist_version)) 0 0 0
4445 0 push @outdd, {
4446 pmpath => $pmpath,
4447 cpan_path => $dni->pathname,
4448 dist_version => $dni->version,
4449 dist_dist => $dni->dist,
4450 };
4451 }
4452 }
4453 }
4454 }
4455 0 ▶ if (@outdd && $allow_outdd ne "yes") {
Branch: 1 branch
BranchTrueFalseTotal
if (@outdd and $allow_outdd ne "yes") 0 0 0
Condition0%0/3
@outdd and $allow_outdd ne "yes"
!ll&&!rl&&r
000
MC/DC0%0/2
@outdd and $allow_outdd ne "yes"
@outdd $allow_outdd ne "yes"
Truth table0%0/3
A and B
A= @outddB= $allow_outdd ne "yes"
ABresult
0X0
100
111
4456 0 my $why = "allow_installing_outdated_dists: $id contains module(s) that are indexed on the CPAN with a different distro: (e.g. '$outdd[0]{pmpath}' is indexed with '$outdd[0]{cpan_path}')";
4457 0 ▶ if ($outdd[0]{dist_dist} eq $dist_dist) {
Branch: 1 branch
BranchTrueFalseTotal
if ($outdd[0]{"dist_dist"} eq $dist_dist) 0 0 0
4458 0 $why .= ", and this has a higher distribution-version, i.e. version '$outdd[0]{dist_version}' is higher than '$dist_version')";
4459 }
4460 0 ▶ if (my($default) = $allow_outdd =~ m|^ask/(.+)|) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($default) = $allow_outdd =~ m[^ask/(.+)]) 0 0 0
4461 0 ▶ $default = "yes" unless $default =~ /^(y|n)/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $default =~ /^(y|n)/i 0 0 0
4462 0 my $answer = CPAN::Shell::colorable_makemaker_prompt
4463 ("$why. Do you want to allow installing it?",
4464 $default, "colorize_warn");
4465 0 ▶ $allow_outdd = $answer =~ /^\s*y/i ? "yes" : "no";
Branch: 1 branch
BranchTrueFalseTotal
$answer =~ /^\s*y/i ? : 0 0 0
4466 }
4467 0 ▶ if ($allow_outdd eq "no") {
Branch: 1 branch
BranchTrueFalseTotal
if ($allow_outdd eq "no") 0 0 0
4468 0 return (0, $why);
4469 }
4470 }
4471 }
4472 }
4473 0 return 1;
4474 }
4475  
4476 0 ▶sub _file_in_path { # similar to CPAN::Module::_file_in_path
Subroutine _file_in_path: not called CC=3 SCAR=24.8
4477 0 my($self,$pmpath,$incpath) = @_;
4478 0 my($dir,@packpath);
4479 0 foreach $dir (@$incpath) {
4480 0 my $pmfile = File::Spec->catfile($dir,$pmpath);
4481 0 ▶ if (-f $pmfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $pmfile) 0 0 0
4482 0 return $pmfile;
4483 }
4484 }
4485 0 return;
4486 }
4487 7 ▶sub introduce_myself {
Subroutine introduce_myself: called CC=1 SCAR=0.0
Pod undocumented
4488 7 my($self) = @_;
4489 7 $CPAN::Frontend->myprint(sprintf(" %s\n",$self->pretty_id));
4490 }
4491  
4492 #-> sub CPAN::Distribution::dir ;
4493 16 ▶sub dir {
Subroutine dir: called CC=1 SCAR=0.0
Pod undocumented
4494 16 shift->{build_dir};
4495 }
4496  
4497 #-> sub CPAN::Distribution::perldoc ;
4498 0 ▶sub perldoc {
Subroutine perldoc: not called CC=4 SCAR=30.0
Pod undocumented
4499 0 my($self) = @_;
4500  
4501 0 my($dist) = $self->id;
4502 0 my $package = $self->called_for;
4503  
4504 0 ▶ if ($CPAN::META->has_inst("Pod::Perldocs")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst('Pod::Perldocs')) { } 0 0 0
4505 0 ▶ my($perl) = $self->perl
Branch: 1 branch
BranchTrueFalseTotal
my($perl) = $self->perl or $CPAN::Frontend->mydie("Couldn't find executable perl\n") 0 0 0
4506 or $CPAN::Frontend->mydie("Couldn't find executable perl\n");
4507 0 my @args = ($perl, q{-MPod::Perldocs}, q{-e},
4508 q{Pod::Perldocs->run()}, $package);
4509 0 my($wstatus);
4510 0 ▶ unless ( ($wstatus = system(@args)) == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (($wstatus = system(@args)) == 0) 0 0 0
4511 0 my $estatus = $wstatus >> 8;
4512 0 $CPAN::Frontend->myprint(qq{
4513 Function system("@args")
4514 returned status $estatus (wstat $wstatus)
4515 });
4516 }
4517 }
4518 else {
4519 0 $self->_display_url( $CPAN::Defaultdocs . $package );
4520 }
4521 }
4522  
4523 #-> sub CPAN::Distribution::_check_binary ;
4524 0 ▶sub _check_binary {
Subroutine _check_binary: not called CC=10 SCAR=47.0
4525 0 my ($dist,$shell,$binary) = @_;
4526 0 my ($pid,$out);
4527  
4528 0 ▶ $CPAN::Frontend->myprint(qq{ + _check_binary($binary)\n})
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4529 if $CPAN::DEBUG;
4530  
4531 0 ▶ if ($CPAN::META->has_inst("File::Which")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst('File::Which')) { } 0 0 0
4532 0 return File::Which::which($binary);
4533 } else {
4534 0 local *README;
4535 0 ▶ $pid = open README, "which $binary|"
Branch: 1 branch
BranchTrueFalseTotal
$pid = open(README, "which $binary|") or $CPAN::Frontend->mywarn("Could not fork 'which ${binary}': $!\n") 0 0 0
4536 or $CPAN::Frontend->mywarn(qq{Could not fork 'which $binary': $!\n});
4537 0 ▶ return unless $pid;
Branch: 1 branch
BranchTrueFalseTotal
unless $pid 0 0 0
4538 0 ▶ while (<README>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline README)) 0 0 0
4539 0 $out .= $_;
4540 }
4541 0 ▶ close README
Branch: 1 branch
BranchTrueFalseTotal
close README or $CPAN::Frontend->mywarn("Could not run 'which ${binary}': $!\n") and return 0 0 0
Condition0%0/5
close README || $CPAN::Frontend->mywarn("Could not run 'which ${binary}': $!\n") && (return)
l!l&&r!l&&!r
000
$CPAN::Frontend->mywarn("Could not run 'which ${binary}': $!\n") and return
!ll
00
MC/DC0%0/2
close README || $CPAN::Frontend->mywarn("Could not run 'which ${binary}': $!\n") && (return)
close README $CPAN::Frontend->mywarn("Could not run 'which ${binary}': $!\n")
Truth table0%0/3
A || B
A= close READMEB= $CPAN::Frontend->mywarn("Could not run 'which ${binary}': $!\n")
ABresult
1X1
011
000
4542 or $CPAN::Frontend->mywarn("Could not run 'which $binary': $!\n")
4543 and return;
4544 }
4545  
4546 0 ▶ $CPAN::Frontend->myprint(qq{ + $out \n})
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG and $out 0 0 0
Condition0%0/3
$CPAN::DEBUG and $out
!ll&&!rl&&r
000
MC/DC0%0/2
$CPAN::DEBUG and $out
$CPAN::DEBUG $out
Truth table0%0/3
A and B
A= $CPAN::DEBUGB= $out
ABresult
0X0
100
111
4547 if $CPAN::DEBUG && $out;
4548  
4549 0 return $out;
4550 }
4551  
4552 #-> sub CPAN::Distribution::_display_url ;
4553 0 ▶sub _display_url {
Subroutine _display_url: not called CC=19 SCAR=59.4
4554 0 my($self,$url) = @_;
4555 0 my($res,$saved_file,$pid,$out);
4556  
4557 0 ▶ $CPAN::Frontend->myprint(qq{ + _display_url($url)\n})
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4558 if $CPAN::DEBUG;
4559  
4560 # should we define it in the config instead?
4561 0 my $html_converter = "html2text.pl";
4562  
4563 0 ▶ my $web_browser = $CPAN::Config->{'lynx'} || undef;
Condition0%0/2
$CPAN::Config->{'lynx'} || undef
l!l
00
MC/DC0%0/1
$CPAN::Config->{'lynx'} || undef
$CPAN::Config->{'lynx'}
Truth table0%0/2
A
A= $CPAN::Config->{'lynx'}
Aresult
11
00
4564 0 ▶ my $web_browser_out = $web_browser
Branch: 1 branch
BranchTrueFalseTotal
$web_browser ? : 0 0 0
4565 ? CPAN::Distribution->_check_binary($self,$web_browser)
4566 : undef;
4567  
4568 0 ▶ if ($web_browser_out) {
Branch: 1 branch
BranchTrueFalseTotal
if ($web_browser_out) { } 0 0 0
4569 # web browser found, run the action
4570 0 my $browser = CPAN::HandleConfig->safe_quote($CPAN::Config->{'lynx'});
4571 0 ▶ $CPAN::Frontend->myprint(qq{system[$browser $url]})
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4572 if $CPAN::DEBUG;
4573 0 $CPAN::Frontend->myprint(qq{
4574 Displaying URL
4575 $url
4576 with browser $browser
4577 });
4578 0 $CPAN::Frontend->mysleep(1);
4579 0 system("$browser $url");
4580 0 ▶ if ($saved_file) { 1 while unlink($saved_file) }
Branch: 2 branches
BranchTrueFalseTotal
if ($saved_file) 0 0 0
unlink $saved_file and do { 1 } 0 0 0
4581 } else {
4582 # web browser not found, let's try text only
4583 0 my $html_converter_out =
4584 CPAN::Distribution->_check_binary($self,$html_converter);
4585 0 $html_converter_out = CPAN::HandleConfig->safe_quote($html_converter_out);
4586  
4587 0 ▶ if ($html_converter_out ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($html_converter_out) { } 0 0 0
4588 # html2text found, run it
4589 0 $saved_file = CPAN::Distribution->_getsave_url( $self, $url );
4590 0 ▶ $CPAN::Frontend->mydie(qq{ERROR: problems while getting $url\n})
Branch: 1 branch
BranchTrueFalseTotal
unless defined $saved_file 0 0 0
4591 unless defined($saved_file);
4592  
4593 0 local *README;
4594 0 ▶ $pid = open README, "$html_converter $saved_file |"
Branch: 1 branch
BranchTrueFalseTotal
$pid = open(README, "$html_converter $saved_file |") or $CPAN::Frontend->mydie("\nCould not fork '$html_converter ${saved_file}': $!") 0 0 0
4595 or $CPAN::Frontend->mydie(qq{
4596 Could not fork '$html_converter $saved_file': $!});
4597 0 my($fh,$filename);
4598 0 ▶ if ($CPAN::META->has_usable("File::Temp")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_usable('File::Temp')) { } 0 0 0
4599 0 $fh = File::Temp->new(
4600 dir => File::Spec->tmpdir,
4601 template => 'cpan_htmlconvert_XXXX',
4602 suffix => '.txt',
4603 unlink => 0,
4604 );
4605 0 $filename = $fh->filename;
4606 } else {
4607 0 $filename = "cpan_htmlconvert_$$.txt";
4608 0 $fh = FileHandle->new();
4609 0 ▶ open $fh, ">$filename" or die;
Branch: 1 branch
BranchTrueFalseTotal
open $fh, ">$filename" or die 0 0 0
4610 }
4611 0 ▶ while (<README>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline README)) 0 0 0
4612 0 $fh->print($_);
4613 }
4614 0 ▶ close README or
Branch: 1 branch
BranchTrueFalseTotal
close README or $CPAN::Frontend->mydie("Could not run '$html_converter ${saved_file}': $!") 0 0 0
4615 $CPAN::Frontend->mydie(qq{Could not run '$html_converter $saved_file': $!});
4616 0 my $tmpin = $fh->filename;
4617 0 ▶ $CPAN::Frontend->myprint(sprintf(qq{
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4618 Run '%s %s' and
4619 saved output to %s\n},
4620 $html_converter,
4621 $saved_file,
4622 $tmpin,
4623 )) if $CPAN::DEBUG;
4624 0 close $fh;
4625 0 local *FH;
4626 0 ▶ open FH, $tmpin
Branch: 1 branch
BranchTrueFalseTotal
open FH, $tmpin or $CPAN::Frontend->mydie(qq[Could not open "$tmpin": $!]) 0 0 0
4627 or $CPAN::Frontend->mydie(qq{Could not open "$tmpin": $!});
4628 0 my $fh_pager = FileHandle->new;
4629 0 local($SIG{PIPE}) = "IGNORE";
4630 0 ▶ my $pager = $CPAN::Config->{'pager'} || "cat";
Condition0%0/2
$CPAN::Config->{'pager'} || 'cat'
l!l
00
MC/DC0%0/1
$CPAN::Config->{'pager'} || 'cat'
$CPAN::Config->{'pager'}
Truth table0%0/2
A
A= $CPAN::Config->{'pager'}
Aresult
11
00
4631 0 ▶ $fh_pager->open("|$pager")
Branch: 1 branch
BranchTrueFalseTotal
$fh_pager->open("|$pager") or $CPAN::Frontend->mydie("\nCould not open pager '${pager}': $!") 0 0 0
4632 or $CPAN::Frontend->mydie(qq{
4633 Could not open pager '$pager': $!});
4634 0 $CPAN::Frontend->myprint(qq{
4635 Displaying URL
4636 $url
4637 with pager "$pager"
4638 });
4639 0 $CPAN::Frontend->mysleep(1);
4640 0 $fh_pager->print(<FH>);
4641 0 $fh_pager->close;
4642 } else {
4643 # coldn't find the web browser or html converter
4644 0 $CPAN::Frontend->myprint(qq{
4645 You need to install lynx or $html_converter to use this feature.});
4646 }
4647 }
4648 }
4649  
4650 #-> sub CPAN::Distribution::_getsave_url ;
4651 0 ▶sub _getsave_url {
Subroutine _getsave_url: not called CC=12 SCAR=50.5
4652 0 my($dist, $shell, $url) = @_;
4653  
4654 0 ▶ $CPAN::Frontend->myprint(qq{ + _getsave_url($url)\n})
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4655 if $CPAN::DEBUG;
4656  
4657 0 my($fh,$filename);
4658 0 ▶ if ($CPAN::META->has_usable("File::Temp")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_usable('File::Temp')) { } 0 0 0
4659 0 $fh = File::Temp->new(
4660 dir => File::Spec->tmpdir,
4661 template => "cpan_getsave_url_XXXX",
4662 suffix => ".html",
4663 unlink => 0,
4664 );
4665 0 $filename = $fh->filename;
4666 } else {
4667 0 $fh = FileHandle->new;
4668 0 $filename = "cpan_getsave_url_$$.html";
4669 }
4670 0 my $tmpin = $filename;
4671 0 ▶ if ($CPAN::META->has_usable('LWP')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_usable('LWP')) { } 0 0 0
4672 0 $CPAN::Frontend->myprint("Fetching with LWP:
4673 $url
4674 ");
4675 0 my $Ua;
4676 0 CPAN::LWP::UserAgent->config;
4677 0 eval { $Ua = CPAN::LWP::UserAgent->new; };
4678 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 0 0
4679 0 $CPAN::Frontend->mywarn("ERROR: CPAN::LWP::UserAgent->new dies with $@\n");
4680 0 return;
4681 } else {
4682 0 my($var);
4683 $Ua->proxy('http', $var)
4684 0 ▶ if $var = $CPAN::Config->{http_proxy} || $ENV{http_proxy};
Branch: 1 branch
BranchTrueFalseTotal
if $var = $CPAN::Config->{"http_proxy"} || $ENV{"http_proxy"} 0 0 0
Condition0%0/3
$CPAN::Config->{'http_proxy'} || $ENV{'http_proxy'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$CPAN::Config->{'http_proxy'} || $ENV{'http_proxy'}
$CPAN::Config->{'http_proxy'} $ENV{'http_proxy'}
Truth table0%0/3
A || B
A= $CPAN::Config->{'http_proxy'}B= $ENV{'http_proxy'}
ABresult
1X1
011
000
4685 $Ua->no_proxy($var)
4686 0 ▶ if $var = $CPAN::Config->{no_proxy} || $ENV{no_proxy};
Branch: 1 branch
BranchTrueFalseTotal
if $var = $CPAN::Config->{"no_proxy"} || $ENV{"no_proxy"} 0 0 0
Condition0%0/3
$CPAN::Config->{'no_proxy'} || $ENV{'no_proxy'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$CPAN::Config->{'no_proxy'} || $ENV{'no_proxy'}
$CPAN::Config->{'no_proxy'} $ENV{'no_proxy'}
Truth table0%0/3
A || B
A= $CPAN::Config->{'no_proxy'}B= $ENV{'no_proxy'}
ABresult
1X1
011
000
4687 }
4688  
4689 0 my $req = HTTP::Request->new(GET => $url);
4690 0 $req->header('Accept' => 'text/html');
4691 0 my $res = $Ua->request($req);
4692 0 ▶ if ($res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->is_success) { } 0 0 0
4693 0 ▶ $CPAN::Frontend->myprint(" + request successful.\n")
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4694 if $CPAN::DEBUG;
4695 0 print $fh $res->content;
4696 0 close $fh;
4697 0 ▶ $CPAN::Frontend->myprint(qq{ + saved content to $tmpin \n})
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4698 if $CPAN::DEBUG;
4699 0 return $tmpin;
4700 } else {
4701 0 $CPAN::Frontend->myprint(sprintf(
4702 "LWP failed with code[%s], message[%s]\n",
4703 $res->code,
4704 $res->message,
4705 ));
4706 0 return;
4707 }
4708 } else {
4709 0 $CPAN::Frontend->mywarn(" LWP not available\n");
4710 0 return;
4711 }
4712 }
4713  
4714 #-> sub CPAN::Distribution::_build_command
4715 0 ▶sub _build_command {
Subroutine _build_command: not called CC=4 SCAR=30.0
4716 0 my($self) = @_;
4717 0 ▶ if ($^O eq "MSWin32") { # special code needed at least up to
Branch: 2 branches
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 0 0
elsif ($^O eq 'VMS') { } 0 0 0
4718 # Module::Build 0.2611 and 0.2706; a fix
4719 # in M:B has been promised 2006-01-30
4720 0 ▶ my($perl) = $self->perl or $CPAN::Frontend->mydie("Couldn't find executable perl\n");
Branch: 1 branch
BranchTrueFalseTotal
my($perl) = $self->perl or $CPAN::Frontend->mydie("Couldn't find executable perl\n") 0 0 0
4721 0 return "$perl ./Build";
4722 }
4723 elsif ($^O eq 'VMS') {
4724 0 return "$^X Build.com";
4725 }
4726 0 return "./Build";
4727 }
4728  
4729 #-> sub CPAN::Distribution::_should_report
4730 13 ▶sub _should_report {
Subroutine _should_report: called CC=13 SCAR=49.3
4731 13 my($self, $phase) = @_;
4732 13 ▶ die "_should_report() requires a 'phase' argument"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $phase 0 13 13
4733 if ! defined $phase;
4734  
4735 13 ▶ return unless $CPAN::META->has_usable("CPAN::Reporter");
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::META->has_usable("CPAN::Reporter") 13 0 13
4736  
4737 # configured
4738 0 my $test_report = CPAN::HandleConfig->prefs_lookup($self,
4739 q{test_report});
4740 0 ▶ return unless $test_report;
Branch: 1 branch
BranchTrueFalseTotal
unless $test_report 0 0 0
4741  
4742 # don't repeat if we cached a result
4743 return $self->{should_report}
4744 0 ▶ if exists $self->{should_report};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"should_report"} 0 0 0
4745  
4746 # don't report if we generated a Makefile.PL
4747 0 ▶ if ( $self->{had_no_makefile_pl} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"had_no_makefile_pl"}) 0 0 0
4748 0 $CPAN::Frontend->mywarn(
4749 "Will not send CPAN Testers report with generated Makefile.PL.\n"
4750 );
4751 0 return $self->{should_report} = 0;
4752 }
4753  
4754 # available
4755 0 ▶ if ( ! $CPAN::META->has_inst("CPAN::Reporter")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_inst("CPAN::Reporter")) 0 0 0
4756 0 $CPAN::Frontend->mywarnonce(
4757 "CPAN::Reporter not installed. No reports will be sent.\n"
4758 );
4759 0 return $self->{should_report} = 0;
4760 }
4761  
4762 # capable
4763 0 my $crv = CPAN::Reporter->VERSION;
4764 0 ▶ if ( CPAN::Version->vlt( $crv, 0.99 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ("CPAN::Version"->vlt($crv, "0.99")) 0 0 0
4765 # don't cache $self->{should_report} -- need to check each phase
4766 0 ▶ if ( $phase eq 'test' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($phase eq 'test') { } 0 0 0
4767 0 return 1;
4768 }
4769 else {
4770 0 $CPAN::Frontend->mywarn(
4771 "Reporting on the '$phase' phase requires CPAN::Reporter 0.99, but \n" .
4772 "you only have version $crv\. Only 'test' phase reports will be sent.\n"
4773 );
4774 0 return;
4775 }
4776 }
4777  
4778 # appropriate
4779 0 ▶ if ($self->is_dot_dist) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_dot_dist) 0 0 0
4780 0 $CPAN::Frontend->mywarn("Reporting via CPAN::Reporter is disabled ".
4781 "for local directories\n");
4782 0 return $self->{should_report} = 0;
4783 }
4784 0 ▶ if ($self->prefs->{patches}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->prefs->{"patches"} and @{$self->prefs->{"patches"};} and $self->{"patched"}) 0 0 0
Condition0%0/6
$self->prefs->{"patches"} and @{$self->prefs->{"patches"};} and $self->{"patched"}
!ll&&!rl&&r
000
$self->prefs->{"patches"} and @{$self->prefs->{"patches"};}
!ll&&!rl&&r
000
MC/DC0%0/3
$self->prefs->{"patches"} and @{$self->prefs->{"patches"};} and $self->{"patched"}
$self->prefs->{"patches"} @{$self->prefs->{"patches"};} $self->{"patched"}
Truth table0%0/4
A and B and C
A= $self->prefs->{"patches"}B= @{$self->prefs->{"patches"};}C= $self->{"patched"}
ABCresult
0XX0
10X0
1100
1111
4785 &&
4786 0 @{$self->prefs->{patches}}
4787 &&
4788 $self->{patched}
4789 ) {
4790 0 $CPAN::Frontend->mywarn("Reporting via CPAN::Reporter is disabled ".
4791 "when the source has been patched\n");
4792 0 return $self->{should_report} = 0;
4793 }
4794  
4795 # proceed and cache success
4796 0 return $self->{should_report} = 1;
4797 }
4798  
4799 #-> sub CPAN::Distribution::reports
4800 0 ▶sub reports {
Subroutine reports: not called CC=27 SCAR=66.3
Pod undocumented
4801 0 my($self) = @_;
4802 0 my $pathname = $self->id;
4803 0 $CPAN::Frontend->myprint("Distribution: $pathname\n");
4804  
4805 0 ▶ unless ($CPAN::META->has_inst("CPAN::DistnameInfo")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_inst("CPAN::DistnameInfo")) 0 0 0
4806 0 $CPAN::Frontend->mydie("CPAN::DistnameInfo not installed; cannot continue");
4807 }
4808 0 ▶ unless ($CPAN::META->has_usable("LWP")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_usable("LWP")) 0 0 0
4809 0 $CPAN::Frontend->mydie("LWP not installed; cannot continue");
4810 }
4811 0 ▶ unless ($CPAN::META->has_usable("File::Temp")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_usable("File::Temp")) 0 0 0
4812 0 $CPAN::Frontend->mydie("File::Temp not installed; cannot continue");
4813 }
4814  
4815 0 my $format;
4816 0 ▶ if ($CPAN::META->has_inst("YAML::XS") || $CPAN::META->has_inst("YAML::Syck")){
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::META->has_inst('YAML::XS') or $CPAN::META->has_inst('YAML::Syck')) { } 0 0 0
elsif (not $format and $CPAN::META->has_inst('JSON::PP')) { } 0 0 0
Condition0%0/3
$CPAN::META->has_inst("YAML::XS") or $CPAN::META->has_inst("YAML::Syck")
l!l&&r!l&&!r
000
MC/DC0%0/2
$CPAN::META->has_inst("YAML::XS") or $CPAN::META->has_inst("YAML::Syck")
$CPAN::META->has_inst("YAML::XS") $CPAN::META->has_inst("YAML::Syck")
Truth table0%0/3
A or B
A= $CPAN::META->has_inst("YAML::XS")B= $CPAN::META->has_inst("YAML::Syck")
ABresult
1X1
011
000
4817 0 $format = 'yaml';
4818 }
4819 ▶ elsif (!$format && $CPAN::META->has_inst("JSON::PP") ) {
Condition0%0/3
not $format and $CPAN::META->has_inst("JSON::PP")
!ll&&!rl&&r
000
MC/DC0%0/2
not $format and $CPAN::META->has_inst("JSON::PP")
not $format $CPAN::META->has_inst("JSON::PP")
Truth table0%0/3
not(A) and B
A= not $formatB= $CPAN::META->has_inst("JSON::PP")
ABresult
0X0
100
111
4820 0 $format = 'json';
4821 }
4822 else {
4823 0 $CPAN::Frontend->mydie("JSON::PP not installed, cannot continue");
4824 }
4825  
4826 0 my $d = CPAN::DistnameInfo->new($pathname);
4827  
4828 0 my $dist = $d->dist; # "CPAN-DistnameInfo"
4829 0 my $version = $d->version; # "0.02"
4830 0 my $maturity = $d->maturity; # "released"
4831 0 my $filename = $d->filename; # "CPAN-DistnameInfo-0.02.tar.gz"
4832 0 my $cpanid = $d->cpanid; # "GBARR"
4833 0 my $distvname = $d->distvname; # "CPAN-DistnameInfo-0.02"
4834  
4835 0 my $url = sprintf "http://www.cpantesters.org/show/%s.%s", $dist, $format;
4836  
4837 0 CPAN::LWP::UserAgent->config;
4838 0 my $Ua;
4839 0 eval { $Ua = CPAN::LWP::UserAgent->new; };
4840 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
4841 0 $CPAN::Frontend->mydie("CPAN::LWP::UserAgent->new dies with $@\n");
4842 }
4843 0 $CPAN::Frontend->myprint("Fetching '$url'...");
4844 0 my $resp = $Ua->get($url);
4845 0 ▶ unless ($resp->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($resp->is_success) 0 0 0
4846 0 $CPAN::Frontend->mydie(sprintf "Could not download '%s': %s\n", $url, $resp->code);
4847 }
4848 0 $CPAN::Frontend->myprint("DONE\n\n");
4849 0 my $unserialized;
4850 0 ▶ if ( $format eq 'yaml' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($format eq 'yaml') { } 0 0 0
4851 0 my $yaml = $resp->content;
4852 # what a long way round!
4853 0 my $fh = File::Temp->new(
4854 dir => File::Spec->tmpdir,
4855 template => 'cpan_reports_XXXX',
4856 suffix => '.yaml',
4857 unlink => 0,
4858 );
4859 0 my $tfilename = $fh->filename;
4860 0 print $fh $yaml;
4861 0 ▶ close $fh or $CPAN::Frontend->mydie("Could not close '$tfilename': $!");
Branch: 1 branch
BranchTrueFalseTotal
close $fh or $CPAN::Frontend->mydie("Could not close '${tfilename}': $!") 0 0 0
4862 0 $unserialized = CPAN->_yaml_loadfile($tfilename)->[0];
4863 0 ▶ unlink $tfilename or $CPAN::Frontend->mydie("Could not unlink '$tfilename': $!");
Branch: 1 branch
BranchTrueFalseTotal
unlink $tfilename or $CPAN::Frontend->mydie("Could not unlink '${tfilename}': $!") 0 0 0
4864 } else {
4865 0 require JSON::PP;
4866 0 $unserialized = JSON::PP->new->utf8->decode($resp->content);
4867 }
4868 0 my %other_versions;
4869 my $this_version_seen;
4870 0 for my $rep (@$unserialized) {
4871 0 my $rversion = $rep->{version};
4872 0 ▶ if ($rversion eq $version) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rversion eq $version) { } 0 0 0
4873 0 ▶ unless ($this_version_seen++) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($this_version_seen++) 0 0 0
4874 0 $CPAN::Frontend->myprint ("$rep->{version}:\n");
4875 }
4876 0 ▶ my $arch = $rep->{archname} || $rep->{platform} || '????';
Condition0%0/5
$rep->{'archname'} || $rep->{'platform'} || '????'
l!l
00
$rep->{"archname"} or $rep->{"platform"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$rep->{'archname'} || $rep->{'platform'} || '????'
$rep->{"archname"} $rep->{"platform"}
Truth table0%0/3
A or B
A= $rep->{"archname"}B= $rep->{"platform"}
ABresult
1X1
011
000
4877 0 ▶ my $grade = $rep->{action} || $rep->{status} || '????';
Condition0%0/5
$rep->{'action'} || $rep->{'status'} || '????'
l!l
00
$rep->{"action"} or $rep->{"status"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$rep->{'action'} || $rep->{'status'} || '????'
$rep->{"action"} $rep->{"status"}
Truth table0%0/3
A or B
A= $rep->{"action"}B= $rep->{"status"}
ABresult
1X1
011
000
4878 0 ▶ my $ostext = $rep->{ostext} || ucfirst($rep->{osname}) || '????';
Condition0%0/5
$rep->{'ostext'} || ucfirst $rep->{'osname'} || '????'
l!l
00
$rep->{"ostext"} or ucfirst $rep->{"osname"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$rep->{'ostext'} || ucfirst $rep->{'osname'} || '????'
$rep->{"ostext"} ucfirst $rep->{"osname"}
Truth table0%0/3
A or B
A= $rep->{"ostext"}B= ucfirst $rep->{"osname"}
ABresult
1X1
011
000
4879 $CPAN::Frontend->myprint
4880 (sprintf("%1s%1s%-4s %s on %s %s (%s)\n",
4881 $arch eq $Config::Config{archname}?"*":"",
4882 $grade eq "PASS"?"+":$grade eq"FAIL"?"-":"",
4883 $grade,
4884 $rep->{perl},
4885 $ostext,
4886 $rep->{osvers},
4887 0 ▶ $arch,
Branch: 3 branches
BranchTrueFalseTotal
$arch eq $Config::Config{'archname'} ? : 0 0 0
$grade eq 'PASS' ? : 0 0 0
$grade eq 'FAIL' ? : 0 0 0
4888 ));
4889 } else {
4890 0 $other_versions{$rep->{version}}++;
4891 }
4892 }
4893 0 ▶ unless ($this_version_seen) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($this_version_seen) 0 0 0
4894 0 $CPAN::Frontend->myprint("No reports found for version '$version'
4895 Reports for other versions:\n");
4896 0 for my $v (sort keys %other_versions) {
4897 0 $CPAN::Frontend->myprint(" $v\: $other_versions{$v}\n");
4898 }
4899 }
4900 0 $url = substr($url,0,-4) . 'html';
4901 0 $CPAN::Frontend->myprint("See $url for details\n");
4902 }
4903  
4904 26 1;
« blib/lib/CPAN/Tarzip.pm ↑ Summary lib/CPAN/Admin.pm »