blib/lib/CPAN/Distribution.pm

filter: Statementstmt 21.9% 814 / 3710 Branchbran 15.4% 372 / 2406 Conditioncond 11.5% 113 / 982 MC/DCmcdc 0.7% 4 / 546 Subroutinesub 39.7% 70 / 176 Podpod 0.0% 0 / 127 totaltotal 17.2% 1373 / 7947 CC 2289 SCAR 63.2
CC
2289
Cov
18%
prepare
2124.9
prepare
2124.9
prereq_pm
1968.4
CRAP 554.5
« 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.42";
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 69 ▶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 54 15 69
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 69 69
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 69 0 69
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 69 0 69
if $has_cm or $has_pcm 0 0 0
Condition16%1/6
$has_cm or $has_pcm
l!l&&r!l&&!r
6900
$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 69 0 69
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 69 0 69
if $has_cm or $has_pcm 0 0 0
Condition16%1/6
$has_cm or $has_pcm
l!l&&r!l&&!r
6900
$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 113 163
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 7 ▶sub want_static_install {
Subroutine want_static_install: called CC=12 SCAR=47.6
Pod undocumented
774 0 ▶ my ($self) = @_;
Subroutine want_static_install: not called CC=12 SCAR=47.6
Pod undocumented
775 0 my $use_static_install = CPAN::HandleConfig->prefs_lookup($self,q{use_static_install});
776 0 ▶ return if defined $use_static_install && 0 == $use_static_install;
Branch: 2 branches
BranchTrueFalseTotal
if defined $use_static_install and 0 == $use_static_install 0 7 7
if defined $use_static_install and 0 == $use_static_install 0 0 0
Condition16%1/6
defined $use_static_install and 0 == $use_static_install
!ll&&!rl&&r
700
defined $use_static_install and 0 == $use_static_install
!ll&&!rl&&r
000
MC/DC0%0/2
defined $use_static_install and 0 == $use_static_install
defined $use_static_install 0 == $use_static_install
MC/DC0%0/2
defined $use_static_install and 0 == $use_static_install
defined $use_static_install 0 == $use_static_install
Truth table33%1/3
A and B
A= defined $use_static_installB= 0 == $use_static_install
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $use_static_installB= 0 == $use_static_install
ABresult
0X0
100
111
777 0 ▶ unless ($CPAN::META->has_inst('CPAN::Static::Install')) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($CPAN::META->has_inst("CPAN::Static::Install")) 7 0 7
unless ($CPAN::META->has_inst("CPAN::Static::Install")) 0 0 0
778 0 ▶ if ($self->looks_like_static_candidate) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->looks_like_static_candidate) 0 7 7
if ($self->looks_like_static_candidate) 0 0 0
779 0 $CPAN::Frontend->mywarn("Warning: 'CPAN::Static::Install' is not installed. I will try to access it nonetheless to enable static installs\n");
780 }
781 0 return;
782 }
783 0 my $min_version = '0.001';
784 0 ▶ unless (eval { CPAN::Static::Install->VERSION($min_version) }){
Branch: 2 branches
BranchTrueFalseTotal
unless (eval { do { "CPAN::Static::Install"->VERSION($min_version) } }) 0 0 0
unless (eval { do { "CPAN::Static::Install"->VERSION($min_version) } }) 0 0 0
785 0 $CPAN::Frontend->mywarn("The currently installed version of 'CPAN::Static::Install' is too old (<$min_version). Please install a fresh version of it\n");
786 0 return;
787 }
788 0 ▶ return unless -f 'META.json';
Branch: 2 branches
BranchTrueFalseTotal
unless -f "META.json" 0 0 0
unless -f "META.json" 0 0 0
789  
790 0 require CPAN::Static::Install;
791 0 my $supports_static_install = eval { CPAN::Static::Install::supports_static_install(); };
792 0 ▶ if (! defined $supports_static_install and $@) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $supports_static_install and $@) 0 0 0
if (not defined $supports_static_install and $@) 0 0 0
Condition0%0/6
not defined $supports_static_install and $@
!ll&&!rl&&r
000
not defined $supports_static_install and $@
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $supports_static_install and $@
not defined $supports_static_install $@
MC/DC0%0/2
not defined $supports_static_install and $@
not defined $supports_static_install $@
Truth table0%0/3
not(A) and B
A= not defined $supports_static_installB= $@
ABresult
0X0
100
111
Truth table0%0/3
not(A) and B
A= not defined $supports_static_installB= $@
ABresult
0X0
100
111
793 0 my $error = $@;
794 0 $CPAN::Frontend->mywarn("Error while trying to determine whether $self->{ID} supports static install: $error");
795 }
796 0 ▶ if ($supports_static_install) {
Branch: 2 branches
BranchTrueFalseTotal
if ($supports_static_install) 0 0 0
if ($supports_static_install) 0 0 0
797 # sanity check
798 0 my $meta_obj = $self->read_meta;
799 0 ▶ if ($meta_obj && $meta_obj->dynamic_config) {
Branch: 2 branches
BranchTrueFalseTotal
if ($meta_obj and $meta_obj->dynamic_config) 0 0 0
if ($meta_obj and $meta_obj->dynamic_config) 0 0 0
Condition0%0/6
$meta_obj and $meta_obj->dynamic_config
!ll&&!rl&&r
000
$meta_obj and $meta_obj->dynamic_config
!ll&&!rl&&r
000
MC/DC0%0/2
$meta_obj and $meta_obj->dynamic_config
$meta_obj $meta_obj->dynamic_config
MC/DC0%0/2
$meta_obj and $meta_obj->dynamic_config
$meta_obj $meta_obj->dynamic_config
Truth table0%0/3
A and B
A= $meta_objB= $meta_obj->dynamic_config
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $meta_objB= $meta_obj->dynamic_config
ABresult
0X0
100
111
800 0 $CPAN::Frontend->mywarn("Error: meta file sets both dynamic_config and x_static_install to true, refusing static install");
801 0 return;
802 }
803 }
804 0 return $supports_static_install;
805 }
806  
807 #-> sub CPAN::Distribution::choose_MM_or_MB ;
808 7 ▶sub choose_MM_or_MB {
Subroutine choose_MM_or_MB: called CC=16 SCAR=50.3
Pod undocumented
809 0 ▶ my($self) = @_;
Subroutine choose_MM_or_MB: not called CC=16 SCAR=50.3
Pod undocumented
810 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
811 0 my $local_file = $self->{localfile};
812 0 my($mpl) = File::Spec->catfile($self->{build_dir},"Makefile.PL");
813 0 my($mpl_exists) = -f $mpl;
814 0 ▶ unless ($mpl_exists) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($mpl_exists) 0 7 7
unless ($mpl_exists) 0 0 0
815 # NFS has been reported to have racing problems after the
816 # renaming of a directory in some environments.
817 # This trick helps.
818 0 $CPAN::Frontend->mysleep(1);
819 my $mpldh = DirHandle->new($self->{build_dir})
820 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
821 0 $mpl_exists = grep /^Makefile\.PL$/, $mpldh->read;
822 0 $mpldh->close;
823 }
824 0 my $prefer_installer = "eumm"; # eumm|mb
825 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
826 0 ▶ if ($mpl_exists) { # they *can* choose
Branch: 2 branches
BranchTrueFalseTotal
if ($mpl_exists) { } 0 0 0
if ($mpl_exists) { } 0 0 0
827 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
828 0 $prefer_installer = CPAN::HandleConfig->prefs_lookup(
829 $self, q{prefer_installer}
830 );
831 # M::B <= 0.35 left a DATA handle open that
832 # causes problems upgrading M::B on Windows
833 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
834 if fileno *Module::Build::Version::DATA;
835 }
836 } else {
837 0 $prefer_installer = "mb";
838 }
839 }
840 0 ▶ if (my $want_static = $self->want_static_install) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $want_static = $self->want_static_install) 0 7 7
if (my $want_static = $self->want_static_install) 0 0 0
841 0 $self->{static_install} = $want_static;
842 }
843  
844 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
845 0 ▶ $prefer_installer = rand()<.5 ? "eumm" : "mb";
Branch: 2 branches
BranchTrueFalseTotal
rand() < 0.5 ? : 0 0 0
rand() < 0.5 ? : 0 0 0
846 }
847 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
848 0 $self->{modulebuild} = 1;
849 } elsif ($self->{archived} eq "patch") {
850 # not an edge case, nothing to install for sure
851 0 my $why = "A patch file cannot be installed";
852 0 $CPAN::Frontend->mywarn("Refusing to handle this file: $why\n");
853 0 $self->{writemakefile} = CPAN::Distrostatus->new("NO $why");
854 } elsif (! $mpl_exists) {
855 0 $self->_edge_cases($mpl,$local_file);
856 }
857 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
858 &&
859 $CPAN::Config->{build_dir_reuse}
860 ) {
861 0 $self->store_persistent_state;
862 }
863 0 return $self;
864 }
865  
866 # see also reanimate_build_dir
867 #-> CPAN::Distribution::store_persistent_state
868 21 ▶sub store_persistent_state {
Subroutine store_persistent_state: called CC=5 SCAR=26.6
Pod undocumented
869 0 ▶ my($self) = @_;
Subroutine store_persistent_state: not called CC=5 SCAR=26.6
Pod undocumented
870 0 my $dir = $self->{build_dir};
871 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
872 0 my $id = $self->id;
873 0 $CPAN::Frontend->mywarnonce("build_dir of $id is not known, ".
874 "will not store persistent state\n");
875 0 return;
876 }
877 # self-build-dir
878 0 my $sbd = Cwd::realpath(
879 File::Spec->catdir($dir, File::Spec->updir ())
880 );
881 # config-build-dir
882 my $cbd = Cwd::realpath(
883 # the catdir is a workaround for bug https://rt.cpan.org/Ticket/Display.html?id=101283
884 0 File::Spec->catdir($CPAN::Config->{build_dir}, File::Spec->curdir())
885 );
886 0 ▶ unless ($sbd eq $cbd) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($sbd eq $cbd) 0 21 21
unless ($sbd eq $cbd) 0 0 0
887 0 $CPAN::Frontend->mywarnonce("Directory '$dir' not below $CPAN::Config->{build_dir}, ".
888 "will not store persistent state\n");
889 0 return;
890 }
891 0 my $file = sprintf "%s.yml", $dir;
892 0 my $yaml_module = CPAN::_yaml_module();
893 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
894 0 CPAN->_yaml_dumpfile(
895 $file,
896 {
897 time => time,
898 perl => CPAN::_perl_fingerprint(),
899 distribution => $self,
900 }
901 );
902 } else {
903 0 $CPAN::Frontend->myprintonce("'$yaml_module' not installed, ".
904 "will not store persistent state\n");
905 }
906 }
907  
908 #-> CPAN::Distribution::try_download
909 0 ▶sub try_download {
Subroutine try_download: not called CC=2 SCAR=17.9
Pod undocumented
910 0 ▶ my($self,$patch) = @_;
Subroutine try_download: not called CC=2 SCAR=17.9
Pod undocumented
911 0 my $norm = $self->normalize($patch);
912 my($local_wanted) =
913 File::Spec->catfile(
914 $CPAN::Config->{keep_source_where},
915 0 "authors",
916 "id",
917 split(/\//,$norm),
918 );
919 0 ▶ $self->debug("Doing localize") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
920 0 return CPAN::FTP->localize("authors/id/$norm",
921 $local_wanted);
922 }
923  
924 {
925 26 my $stdpatchargs = "";
926 #-> CPAN::Distribution::patch
927 7 ▶ sub patch {
Subroutine patch: called CC=31 SCAR=67.8
Pod undocumented
928 0 ▶ my($self) = @_;
Subroutine patch: not called CC=31 SCAR=67.8
Pod undocumented
929 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
930 0 my $patches = $self->prefs->{patches};
931 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
932 0 ▶ $self->debug("patches[$patches]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
933 0 ▶ if ($patches) {
Branch: 2 branches
BranchTrueFalseTotal
if ($patches) 0 7 7
if ($patches) 0 0 0
934 0 ▶ return unless @$patches;
Branch: 2 branches
BranchTrueFalseTotal
unless @$patches 0 0 0
unless @$patches 0 0 0
935 0 $self->safe_chdir($self->{build_dir});
936 0 ▶ CPAN->debug("patches[$patches]") if $CPAN::DEBUG;
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
937 0 my $patchbin = $CPAN::Config->{patch};
938 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
939 0 $CPAN::Frontend->mydie("No external patch command configured\n\n".
940 "Please run 'o conf init /patch/'\n\n");
941 }
942 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
943 0 $CPAN::Frontend->mydie("No external patch command available\n\n".
944 "Please run 'o conf init /patch/'\n\n");
945 }
946 0 $patchbin = CPAN::HandleConfig->safe_quote($patchbin);
947 0 local $ENV{PATCH_GET} = 0; # formerly known as -g0
948 0 ▶ unless ($stdpatchargs) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($stdpatchargs) 0 0 0
unless ($stdpatchargs) 0 0 0
949 0 my $system = "$patchbin --version |";
950 0 local *FH;
951 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
952 0 local $/ = "\n";
953 0 my $pversion;
954 0 ▶ PARSEVERSION: while (<FH>) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined($_ = readline FH)) 0 0 0
if (defined($_ = readline FH)) 0 0 0
955 0 ▶ if (/^patch\s+([\d\.]+)/) {
Branch: 2 branches
BranchTrueFalseTotal
if (/^patch\s+([\d\.]+)/) 0 0 0
if (/^patch\s+([\d\.]+)/) 0 0 0
956 0 $pversion = $1;
957 0 last PARSEVERSION;
958 }
959 }
960 0 ▶ if ($pversion) {
Branch: 2 branches
BranchTrueFalseTotal
if ($pversion) { } 0 0 0
if ($pversion) { } 0 0 0
961 0 $stdpatchargs = "-N --fuzz=3";
962 } else {
963 0 $stdpatchargs = "-N";
964 }
965 }
966 0 ▶ my $countedpatches = @$patches == 1 ? "1 patch" : (scalar @$patches . " patches");
Branch: 2 branches
BranchTrueFalseTotal
@$patches == 1 ? : 0 0 0
@$patches == 1 ? : 0 0 0
967 0 $CPAN::Frontend->myprint("Applying $countedpatches:\n");
968 0 my $patches_dir = $CPAN::Config->{patches_dir};
969 0 for my $patch (@$patches) {
970 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
971 0 my $f = File::Spec->catfile($patches_dir, $patch);
972 0 ▶ $patch = $f if -f $f;
Branch: 2 branches
BranchTrueFalseTotal
if -f $f 0 0 0
if -f $f 0 0 0
973 }
974 0 ▶ unless (-f $patch) {
Branch: 2 branches
BranchTrueFalseTotal
unless (-f $patch) 0 0 0
unless (-f $patch) 0 0 0
975 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
976 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
977 0 $patch = $trydl;
978 } else {
979 0 my $fail = "Could not find patch '$patch'";
980 0 $CPAN::Frontend->mywarn("$fail; cannot continue\n");
981 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- $fail");
982 0 delete $self->{build_dir};
983 0 return;
984 }
985 }
986 0 $CPAN::Frontend->myprint(" $patch\n");
987 0 my $readfh = CPAN::Tarzip->TIEHANDLE($patch);
988  
989 0 my $pcommand;
990 0 my($ppp,$pfiles) = $self->_patch_p_parameter($readfh);
991 0 ▶ if ($ppp eq "applypatch") {
Branch: 2 branches
BranchTrueFalseTotal
if ($ppp eq 'applypatch') { } 0 0 0
if ($ppp eq 'applypatch') { } 0 0 0
992 0 $pcommand = "$CPAN::Config->{applypatch} -verbose";
993 } else {
994 0 my $thispatchargs = join " ", $stdpatchargs, $ppp;
995 0 $pcommand = "$patchbin $thispatchargs";
996 0 require Config; # usually loaded from CPAN.pm
997 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
998 # native solaris patch cannot patch readonly files
999 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
1000 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
1001 0 chmod $stat[2] | 0600, $file; # may fail
1002 }
1003 }
1004 }
1005  
1006 0 $readfh = CPAN::Tarzip->TIEHANDLE($patch); # open again
1007 0 my $writefh = FileHandle->new;
1008 0 $CPAN::Frontend->myprint(" $pcommand\n");
1009 0 ▶ unless (open $writefh, "|$pcommand") {
Branch: 2 branches
BranchTrueFalseTotal
unless (open $writefh, "|$pcommand") 0 0 0
unless (open $writefh, "|$pcommand") 0 0 0
1010 0 my $fail = "Could not fork '$pcommand'";
1011 0 $CPAN::Frontend->mywarn("$fail; cannot continue\n");
1012 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- $fail");
1013 0 delete $self->{build_dir};
1014 0 return;
1015 }
1016 0 binmode($writefh);
1017 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
1018 0 print $writefh $x;
1019 }
1020 0 ▶ unless (close $writefh) {
Branch: 2 branches
BranchTrueFalseTotal
unless (close $writefh) 0 0 0
unless (close $writefh) 0 0 0
1021 0 my $fail = "Could not apply patch '$patch'";
1022 0 $CPAN::Frontend->mywarn("$fail; cannot continue\n");
1023 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- $fail");
1024 0 delete $self->{build_dir};
1025 0 return;
1026 }
1027 }
1028 0 $self->{patched}++;
1029 }
1030 0 return 1;
1031 }
1032 }
1033  
1034 # may return
1035 # - "applypatch"
1036 # - ("-p0"|"-p1", $files)
1037 26 ▶sub _patch_p_parameter {
Subroutine _patch_p_parameter: not called CC=9 SCAR=44.6
1038 0 ▶ my($self,$fh) = @_;
Subroutine _patch_p_parameter: not called CC=9 SCAR=45.0
1039 0 my $cnt_files = 0;
1040 0 my $cnt_p0files = 0;
1041 0 my @files;
1042 0 local($_);
1043 0 ▶ while ($_ = $fh->READLINE) {
Branch: 2 branches
BranchTrueFalseTotal
if ($_ = $fh->READLINE) 0 0 0
if ($_ = $fh->READLINE) 0 0 0
1044 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
1045 $CPAN::Config->{applypatch}
1046 &&
1047 /\#\#\#\# ApplyPatch data follows \#\#\#\#/
1048 ) {
1049 0 return "applypatch"
1050 }
1051 0 ▶ next unless /^[\*\+]{3}\s(\S+)/;
Branch: 2 branches
BranchTrueFalseTotal
unless /^[\*\+]{3}\s(\S+)/ 0 0 0
unless /^[\*\+]{3}\s(\S+)/ 0 0 0
1052 0 my $file = $1;
1053 0 push @files, $file;
1054 0 $cnt_files++;
1055 0 ▶ $cnt_p0files++ if -f $file;
Branch: 2 branches
BranchTrueFalseTotal
if -f $file 0 0 0
if -f $file 0 0 0
1056 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
1057 if $CPAN::DEBUG;
1058 }
1059 0 ▶ return "-p1" unless $cnt_files;
Branch: 2 branches
BranchTrueFalseTotal
unless $cnt_files 0 0 0
unless $cnt_files 0 0 0
1060 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
1061 0 return ($opt_p, \@files);
1062 }
1063  
1064 #-> sub CPAN::Distribution::_edge_cases
1065 # with "configure" or "Makefile" or single file scripts
1066 0 ▶sub _edge_cases {
Subroutine _edge_cases: not called CC=10 SCAR=47.0
1067 0 ▶ my($self,$mpl,$local_file) = @_;
Subroutine _edge_cases: not called CC=10 SCAR=47.0
1068 0 ▶ $self->debug(sprintf("makefilepl[%s]anycwd[%s]",
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
if $CPAN::DEBUG 0 0 0
1069 $mpl,
1070 CPAN::anycwd(),
1071 )) if $CPAN::DEBUG;
1072 0 my $build_dir = $self->{build_dir};
1073 0 my($configure) = File::Spec->catfile($build_dir,"Configure");
1074 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
1075 # do we have anything to do?
1076 0 $self->{configure} = $configure;
1077 } elsif (-f File::Spec->catfile($build_dir,"Makefile")) {
1078 0 $CPAN::Frontend->mywarn(qq{
1079 Package comes with a Makefile and without a Makefile.PL.
1080 We\'ll try to build it with that Makefile then.
1081 });
1082 0 $self->{writemakefile} = CPAN::Distrostatus->new("YES");
1083 0 $CPAN::Frontend->mysleep(2);
1084 } else {
1085 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
1086 0 ▶ if ($cf =~ m|/|) {
Branch: 2 branches
BranchTrueFalseTotal
if ($cf =~ m[/]) 0 0 0
if ($cf =~ m[/]) 0 0 0
1087 0 $cf =~ s|.*/||;
1088 0 $cf =~ s|\W.*||;
1089 }
1090 0 $cf =~ s|[/\\:]||g; # risk of filesystem damage
1091 0 ▶ $cf = "unknown" unless length($cf);
Branch: 2 branches
BranchTrueFalseTotal
unless length $cf 0 0 0
unless length $cf 0 0 0
1092 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
1093 0 my $why = qq{Package contains $crud; not recognized as a perl package, giving up};
1094 0 $CPAN::Frontend->mywarn("$why\n");
1095 0 $self->{writemakefile} = CPAN::Distrostatus->new(qq{NO -- $why});
1096 0 return;
1097 }
1098 0 $CPAN::Frontend->mywarn(qq{Package seems to come without Makefile.PL.
1099 (The test -f "$mpl" returned false.)
1100 Writing one on our own (setting NAME to $cf)\a\n});
1101 0 $self->{had_no_makefile_pl}++;
1102 0 $CPAN::Frontend->mysleep(3);
1103  
1104 # Writing our own Makefile.PL
1105  
1106 0 my $exefile_stanza = "";
1107 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
1108 0 $exefile_stanza = $self->_exefile_stanza($build_dir,$local_file);
1109 }
1110  
1111 0 my $fh = FileHandle->new;
1112 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
1113 or Carp::croak("Could not open >$mpl: $!");
1114 0 $fh->print(
1115 qq{# This Makefile.PL has been autogenerated by the module CPAN.pm
1116 # because there was no Makefile.PL supplied.
1117 # Autogenerated on: }.scalar localtime().qq{
1118  
1119 use ExtUtils::MakeMaker;
1120 WriteMakefile(
1121 NAME => q[$cf],$exefile_stanza
1122 );
1123 });
1124 0 $fh->close;
1125 }
1126 }
1127  
1128 #-> CPAN;:Distribution::_contains_crud
1129 0 ▶sub _contains_crud {
Subroutine _contains_crud: not called CC=9 SCAR=45.0
1130 0 ▶ my($self,$dir) = @_;
Subroutine _contains_crud: not called CC=9 SCAR=45.0
1131 0 my(@dirs, $dh, @files);
1132 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
1133 0 my $dirent;
1134 0 for $dirent (readdir $dh) {
1135 0 ▶ next if $dirent =~ /^\.\.?$/;
Branch: 2 branches
BranchTrueFalseTotal
if $dirent =~ /^\.\.?$/ 0 0 0
if $dirent =~ /^\.\.?$/ 0 0 0
1136 0 my $path = File::Spec->catdir($dir,$dirent);
1137 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
1138 0 push @dirs, $dirent;
1139 } elsif (-f $path) {
1140 0 push @files, $dirent;
1141 }
1142 }
1143 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
1144 0 return "both files[@files] and directories[@dirs]";
1145 } elsif (@files > 2) {
1146 0 return "several files[@files] but no Makefile.PL or Build.PL";
1147 }
1148 0 return;
1149 }
1150  
1151 #-> CPAN;:Distribution::_exefile_stanza
1152 0 ▶sub _exefile_stanza {
Subroutine _exefile_stanza: not called CC=18 SCAR=58.3
1153 0 ▶ my($self,$build_dir,$local_file) = @_;
Subroutine _exefile_stanza: not called CC=18 SCAR=58.3
1154  
1155 0 my $fh = FileHandle->new;
1156 0 my $script_file = File::Spec->catfile($build_dir,$local_file);
1157 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
1158 or Carp::croak("Could not open script '$script_file': $!");
1159 0 local $/ = "\n";
1160 # parse name and prereq
1161 0 my($state) = "poddir";
1162 0 my($name, $prereq) = ("", "");
1163 0 ▶ while (<$fh>) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
if (defined($_ = readline $fh)) 0 0 0
1164 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
1165 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
1166 0 $state = "name";
1167 } elsif ($1 eq 'PREREQUISITES') {
1168 0 $state = "prereq";
1169 }
1170 } elsif ($state =~ m{^(name|prereq)$}) {
1171 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
1172 0 $state = "poddir";
1173 } elsif (/^\s*$/) {
1174 # nop
1175 } elsif ($state eq "name") {
1176 0 ▶ if ($name eq "") {
Branch: 2 branches
BranchTrueFalseTotal
if ($name eq "") 0 0 0
if ($name eq "") 0 0 0
1177 0 ($name) = /^(\S+)/;
1178 0 $state = "poddir";
1179 }
1180 } elsif ($state eq "prereq") {
1181 0 $prereq .= $_;
1182 }
1183 } elsif (/^=cut\b/) {
1184 0 last;
1185 }
1186 }
1187 0 $fh->close;
1188  
1189 0 for ($name) {
1190 0 s{.*<}{}; # strip X<...>
1191 0 s{>.*}{};
1192 }
1193 0 chomp $prereq;
1194 0 $prereq = join " ", split /\s+/, $prereq;
1195 my($PREREQ_PM) = join("\n", map {
1196 0 s{.*<}{}; # strip X<...>
1197 0 s{>.*}{};
1198 0 ▶ if (/[\s\'\"]/) { # prose?
Branch: 2 branches
BranchTrueFalseTotal
if (/[\s\'\"]/) { } 0 0 0
if (/[\s\'\"]/) { } 0 0 0
1199 } else {
1200 0 s/[^\w:]$//; # period?
1201 0 " "x28 . "'$_' => 0,";
1202 }
1203 } split /\s*,\s*/, $prereq);
1204  
1205 0 ▶ if ($name) {
Branch: 2 branches
BranchTrueFalseTotal
if ($name) 0 0 0
if ($name) 0 0 0
1206 0 my $to_file = File::Spec->catfile($build_dir, $name);
1207 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
1208 or die "Can't rename $script_file to $to_file: $!";
1209 }
1210  
1211 0 return "
1212 EXE_FILES => ['$name'],
1213 PREREQ_PM => {
1214 $PREREQ_PM
1215 },
1216 ";
1217 }
1218  
1219 #-> CPAN::Distribution::_signature_business
1220 7 ▶sub _signature_business {
Subroutine _signature_business: called CC=10 SCAR=45.5
1221 0 ▶ my($self) = @_;
Subroutine _signature_business: not called CC=10 SCAR=45.5
1222 0 my $check_sigs = CPAN::HandleConfig->prefs_lookup($self,
1223 q{check_sigs});
1224 0 ▶ if ($check_sigs) {
Branch: 2 branches
BranchTrueFalseTotal
if ($check_sigs) 0 7 7
if ($check_sigs) 0 0 0
1225 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
1226 0 ▶ if (-f "SIGNATURE") {
Branch: 2 branches
BranchTrueFalseTotal
if (-f 'SIGNATURE') { } 0 0 0
if (-f 'SIGNATURE') { } 0 0 0
1227 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
1228 0 my $rv = Module::Signature::verify();
1229 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
1230 $rv != Module::Signature::SIGNATURE_MISSING()) {
1231 0 $CPAN::Frontend->mywarn(
1232 qq{\nSignature invalid for }.
1233 qq{distribution file. }.
1234 qq{Please investigate.\n\n}
1235 );
1236  
1237 my $wrap =
1238 sprintf(qq{I'd recommend removing %s. Some error occurred }.
1239 qq{while checking its signature, so it could }.
1240 qq{be invalid. Maybe you have configured }.
1241 qq{your 'urllist' with a bad URL. Please check this }.
1242 qq{array with 'o conf urllist' and retry. Or }.
1243 qq{examine the distribution in a subshell. Try
1244 look %s
1245 and run
1246 cpansign -v
1247 },
1248 $self->{localfile},
1249 0 $self->pretty_id,
1250 );
1251 0 $self->{signature_verify} = CPAN::Distrostatus->new("NO");
1252 0 $CPAN::Frontend->mywarn(Text::Wrap::wrap("","",$wrap));
1253 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
1254 } else {
1255 0 $self->{signature_verify} = CPAN::Distrostatus->new("YES");
1256 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
1257 }
1258 } else {
1259 0 $CPAN::Frontend->mywarn(qq{Package came without SIGNATURE\n\n});
1260 }
1261 } else {
1262 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
1263 }
1264 }
1265 }
1266  
1267 #-> CPAN::Distribution::untar_me ;
1268 7 ▶sub untar_me {
Subroutine untar_me: called CC=2 SCAR=10.7
Pod undocumented
1269 0 ▶ my($self,$ct) = @_;
Subroutine untar_me: not called CC=2 SCAR=10.7
Pod undocumented
1270 0 $self->{archived} = "tar";
1271 0 my $result = eval { $ct->untar() };
1272 0 ▶ if ($result) {
Branch: 2 branches
BranchTrueFalseTotal
if ($result) { } 7 0 7
if ($result) { } 0 0 0
1273 0 $self->{unwrapped} = CPAN::Distrostatus->new("YES");
1274 } else {
1275 # unfortunately we have no $@ here, Tarzip is using mydie which dies with "\n"
1276 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- untar failed");
1277 }
1278 }
1279  
1280 # CPAN::Distribution::unzip_me ;
1281 0 ▶sub unzip_me {
Subroutine unzip_me: not called CC=2 SCAR=17.9
Pod undocumented
1282 0 ▶ my($self,$ct) = @_;
Subroutine unzip_me: not called CC=2 SCAR=17.9
Pod undocumented
1283 0 $self->{archived} = "zip";
1284 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
1285 0 $self->{unwrapped} = CPAN::Distrostatus->new("YES");
1286 } else {
1287 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- unzip failed during unzip");
1288 }
1289 0 return;
1290 }
1291  
1292 0 ▶sub handle_singlefile {
Subroutine handle_singlefile: not called CC=6 SCAR=37.4
Pod undocumented
1293 0 ▶ my($self,$local_file) = @_;
Subroutine handle_singlefile: not called CC=6 SCAR=37.4
Pod undocumented
1294  
1295 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
1296 0 $self->{archived} = "pm";
1297 } elsif ( $local_file =~ /\.patch(\.(gz|bz2))?(?!\n)\Z/ ) {
1298 0 $self->{archived} = "patch";
1299 } else {
1300 0 $self->{archived} = "maybe_pl";
1301 }
1302  
1303 0 my $to = File::Basename::basename($local_file);
1304 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
1305 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
1306 0 $self->{unwrapped} = CPAN::Distrostatus->new("YES");
1307 } else {
1308 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- uncompressing failed");
1309 }
1310 } else {
1311 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
1312 0 $self->{unwrapped} = CPAN::Distrostatus->new("YES");
1313 } else {
1314 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO -- copying failed");
1315 }
1316 }
1317 0 return $to;
1318 }
1319  
1320 #-> sub CPAN::Distribution::new ;
1321 93 ▶sub new {
Subroutine new: called CC=1 SCAR=1.2
Pod undocumented
1322 0 ▶ my($class,%att) = @_;
Subroutine new: not called CC=1 SCAR=1.2
Pod undocumented
1323  
1324 # $CPAN::META->{cachemgr} ||= CPAN::CacheMgr->new();
1325  
1326 0 my $this = { %att };
1327 0 return bless $this, $class;
1328 }
1329  
1330 #-> sub CPAN::Distribution::look ;
1331 0 ▶sub look {
Subroutine look: not called CC=10 SCAR=47.0
Pod undocumented
1332 0 ▶ my($self) = @_;
Subroutine look: not called CC=10 SCAR=47.0
Pod undocumented
1333  
1334 0 ▶ if ( $CPAN::Config->{'shell'} ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Config->{'shell'}) { } 0 0 0
if ($CPAN::Config->{'shell'}) { } 0 0 0
1335 0 $CPAN::Frontend->myprint(qq{
1336 Trying to open a subshell in the build directory...
1337 });
1338 } else {
1339 0 $CPAN::Frontend->myprint(qq{
1340 Your configuration does not define a value for subshells.
1341 Please define it with "o conf shell <your shell>"
1342 });
1343 0 return;
1344 }
1345 0 my $dist = $self->id;
1346 0 my $dir;
1347 0 ▶ unless ($dir = $self->dir) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($dir = $self->dir) 0 0 0
unless ($dir = $self->dir) 0 0 0
1348 0 $self->get;
1349 }
1350 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
1351 0 $CPAN::Frontend->mywarn(qq{
1352 Could not determine which directory to use for looking at $dist.
1353 });
1354 0 return;
1355 }
1356 0 my $pwd = CPAN::anycwd();
1357 0 $self->safe_chdir($dir);
1358 0 $CPAN::Frontend->myprint(qq{Working directory is $dir\n});
1359 {
1360 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
1361 0 $ENV{CPAN_SHELL_LEVEL} += 1;
1362 0 my $shell = CPAN::HandleConfig->safe_quote($CPAN::Config->{'shell'});
1363  
1364 local $ENV{PERL5LIB} = defined($ENV{PERL5LIB})
1365 ? $ENV{PERL5LIB}
1366 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
1367  
1368 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
1369 # local $ENV{PERL_USE_UNSAFE_INC} = exists $ENV{PERL_USE_UNSAFE_INC} ? $ENV{PERL_USE_UNSAFE_INC} : 1; # look
1370 0 $CPAN::META->set_perl5lib;
1371 0 local $ENV{MAKEFLAGS}; # protect us from outer make calls
1372  
1373 0 ▶ unless (system($shell) == 0) {
Branch: 2 branches
BranchTrueFalseTotal
unless (system($shell) == 0) 0 0 0
unless (system($shell) == 0) 0 0 0
1374 0 my $code = $? >> 8;
1375 0 $CPAN::Frontend->mywarn("Subprocess shell exit code $code\n");
1376 }
1377 }
1378 0 $self->safe_chdir($pwd);
1379 }
1380  
1381 # CPAN::Distribution::cvs_import ;
1382 0 ▶sub cvs_import {
Subroutine cvs_import: not called CC=7 SCAR=40.3
Pod undocumented
1383 0 ▶ my($self) = @_;
Subroutine cvs_import: not called CC=7 SCAR=40.3
Pod undocumented
1384 0 $self->get;
1385 0 my $dir = $self->dir;
1386  
1387 0 my $package = $self->called_for;
1388 0 my $module = $CPAN::META->instance('CPAN::Module', $package);
1389 0 my $version = $module->cpan_version;
1390  
1391 0 my $userid = $self->cpan_userid;
1392  
1393 0 my $cvs_dir = (split /\//, $dir)[-1];
1394 0 $cvs_dir =~ s/-\d+[^-]+(?!\n)\Z//;
1395 my $cvs_root =
1396 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
1397 my $cvs_site_perl =
1398 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
1399 0 ▶ if ($cvs_site_perl) {
Branch: 2 branches
BranchTrueFalseTotal
if ($cvs_site_perl) 0 0 0
if ($cvs_site_perl) 0 0 0
1400 0 $cvs_dir = "$cvs_site_perl/$cvs_dir";
1401 }
1402 0 my $cvs_log = qq{"imported $package $version sources"};
1403 0 $version =~ s/\./_/g;
1404 # XXX cvs: undocumented and unclear how it was meant to work
1405 0 my @cmd = ('cvs', '-d', $cvs_root, 'import', '-m', $cvs_log,
1406 "$cvs_dir", $userid, "v$version");
1407  
1408 0 my $pwd = CPAN::anycwd();
1409 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
1410  
1411 0 $CPAN::Frontend->myprint(qq{Working directory is $dir\n});
1412  
1413 0 $CPAN::Frontend->myprint(qq{@cmd\n});
1414 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
1415 # XXX cvs
1416 $CPAN::Frontend->mydie("cvs import failed");
1417 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
1418 }
1419  
1420 #-> sub CPAN::Distribution::readme ;
1421 0 ▶sub readme {
Subroutine readme: not called CC=7 SCAR=40.3
Pod undocumented
1422 0 ▶ my($self) = @_;
Subroutine readme: not called CC=7 SCAR=40.3
Pod undocumented
1423 0 my($dist) = $self->id;
1424 0 my($sans,$suffix) = $dist =~ /(.+)\.(tgz|tar[\._-]gz|tar\.Z|zip)$/;
1425 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
1426 0 my($local_file);
1427 my($local_wanted) =
1428 File::Spec->catfile(
1429 $CPAN::Config->{keep_source_where},
1430 0 "authors",
1431 "id",
1432 split(/\//,"$sans.readme"),
1433 );
1434 0 my $readme = "authors/id/$sans.readme";
1435 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
1436 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
1437 $local_wanted)
1438 or $CPAN::Frontend->mydie(qq{No $sans.readme found});
1439  
1440 0 my $fh_pager = FileHandle->new;
1441 0 local($SIG{PIPE}) = "IGNORE";
1442 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
1443 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
1444 or die "Could not open pager $pager\: $!";
1445 0 my $fh_readme = FileHandle->new;
1446 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
1447 or $CPAN::Frontend->mydie(qq{Could not open "$local_file": $!});
1448 0 $CPAN::Frontend->myprint(qq{
1449 Displaying file
1450 $local_file
1451 with pager "$pager"
1452 });
1453 0 $fh_pager->print(<$fh_readme>);
1454 0 $fh_pager->close;
1455 }
1456  
1457 #-> sub CPAN::Distribution::verifyCHECKSUM ;
1458 7 ▶sub verifyCHECKSUM {
Subroutine verifyCHECKSUM: called CC=12 SCAR=44.3
Pod undocumented
1459 0 ▶ my($self) = @_;
Subroutine verifyCHECKSUM: not called CC=12 SCAR=44.3
Pod undocumented
1460 EXCUSE: {
1461 0 my @e;
1462 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
1463 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
1464 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
1465 }
1466 0 my($lc_want,$lc_file,@local,$basename);
1467 0 @local = split(/\//,$self->id);
1468 0 pop @local;
1469 0 push @local, "CHECKSUMS";
1470 $lc_want =
1471 File::Spec->catfile($CPAN::Config->{keep_source_where},
1472 0 "authors", "id", @local);
1473 0 local($") = "/";
1474 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
1475 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
1476 0 my @stat = stat $lc_want;
1477 0 my $epoch_starting_support_of_cpan_path = 1637471530;
1478 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
1479 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
1480 0 return $self->{CHECKSUM_STATUS} = "OK";
1481 }
1482 } else {
1483 0 unlink $lc_want;
1484 }
1485 }
1486 0 $lc_file = CPAN::FTP->localize("authors/id/@local",
1487 $lc_want,1);
1488 0 ▶ unless ($lc_file) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($lc_file) 0 7 7
unless ($lc_file) 0 0 0
1489 0 $CPAN::Frontend->myprint("Trying $lc_want.gz\n");
1490 0 $local[-1] .= ".gz";
1491 0 $lc_file = CPAN::FTP->localize("authors/id/@local",
1492 "$lc_want.gz",1);
1493 0 ▶ if ($lc_file) {
Branch: 2 branches
BranchTrueFalseTotal
if ($lc_file) { } 0 0 0
if ($lc_file) { } 0 0 0
1494 0 $lc_file =~ s/\.gz(?!\n)\Z//;
1495 0 eval{CPAN::Tarzip->new("$lc_file.gz")->gunzip($lc_file)};
1496 } else {
1497 0 return;
1498 }
1499 }
1500 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
1501 0 return $self->{CHECKSUM_STATUS} = "OK";
1502 }
1503 }
1504  
1505 #-> sub CPAN::Distribution::SIG_check_file ;
1506 0 ▶sub SIG_check_file {
Subroutine SIG_check_file: not called CC=3 SCAR=24.8
Pod undocumented
1507 0 ▶ my($self,$chk_file) = @_;
Subroutine SIG_check_file: not called CC=3 SCAR=24.8
Pod undocumented
1508 0 my $rv = eval { Module::Signature::_verify($chk_file) };
1509  
1510 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
1511 0 $CPAN::Frontend->myprint(qq{\nSignature for }.
1512 qq{file $chk_file could not be verified for an unknown reason. }.
1513 $self->as_string.
1514 qq{Module::Signature verification returned value $rv\n\n}
1515 );
1516  
1517 0 my $wrap = qq{The manual says for this case: Cannot verify the
1518 OpenPGP signature, maybe due to the lack of a network connection to
1519 the key server, or if neither gnupg nor Crypt::OpenPGP exists on the
1520 system. You probably want to analyse the situation and if you cannot
1521 fix it you will have to decide whether you want to stop this session
1522 or you want to turn off signature verification. The latter would be
1523 done with the command 'o conf init check_sigs'};
1524  
1525 0 $CPAN::Frontend->mydie(Text::Wrap::wrap("","",$wrap));
1526 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
1527 0 $CPAN::Frontend->myprint("Signature for $chk_file ok\n");
1528 0 return $self->{SIG_STATUS} = "OK";
1529 } else {
1530 0 $CPAN::Frontend->mywarn(qq{\nSignature invalid for }.
1531 qq{file $chk_file. }.
1532 qq{Please investigate.\n\n}.
1533 $self->as_string.
1534 qq{Module::Signature verification returned value $rv\n\n}
1535 );
1536  
1537 0 my $wrap = qq{I\'d recommend removing $chk_file. Its signature
1538 is invalid. Maybe you have configured your 'urllist' with
1539 a bad URL. Please check this array with 'o conf urllist', and
1540 retry.};
1541  
1542 0 $CPAN::Frontend->mydie(Text::Wrap::wrap("","",$wrap));
1543 }
1544 }
1545  
1546 #-> sub CPAN::Distribution::CHECKSUM_check_file ;
1547  
1548 # sloppy is 1 when we have an old checksums file that maybe is good
1549 # enough
1550  
1551 7 ▶sub CHECKSUM_check_file {
Subroutine CHECKSUM_check_file: called CC=32 SCAR=64.7
Pod undocumented
1552 0 ▶ my($self,$chk_file,$sloppy) = @_;
Subroutine CHECKSUM_check_file: not called CC=32 SCAR=64.7
Pod undocumented
1553 0 my($cksum,$file,$basename);
1554  
1555 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
1556 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
1557 0 my $check_sigs = CPAN::HandleConfig->prefs_lookup($self,
1558 q{check_sigs});
1559 0 ▶ if ($check_sigs) {
Branch: 2 branches
BranchTrueFalseTotal
if ($check_sigs) 0 7 7
if ($check_sigs) 0 0 0
1560 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
1561 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
1562 0 $self->SIG_check_file($chk_file);
1563 } else {
1564 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
1565 }
1566 }
1567  
1568 0 $file = $self->{localfile};
1569 0 $basename = File::Basename::basename($file);
1570 0 my($signed_data);
1571 0 my $fh = FileHandle->new;
1572 0 ▶ if ($check_sigs) {
Branch: 2 branches
BranchTrueFalseTotal
if ($check_sigs) { } 0 7 7
if ($check_sigs) { } 0 0 0
1573 0 my $tempdir;
1574 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
1575 0 $tempdir = File::Temp::tempdir("CHECKSUMS-XXXX", CLEANUP => 1, DIR => "/tmp" );
1576 } else {
1577 0 $tempdir = File::Spec->catdir(File::Spec->tmpdir, "CHECKSUMS-$$");
1578 0 File::Path::mkpath($tempdir);
1579 }
1580 0 my $tempfile = File::Spec->catfile($tempdir, "CHECKSUMS.$$");
1581 0 unlink $tempfile; # ignore missing file
1582 0 my $devnull = File::Spec->devnull;
1583 my $gpg = $CPAN::Config->{gpg} or
1584 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
1585 0 my $system = qq{"$gpg" --verify --batch --no-tty --output "$tempfile" "$chk_file" 2> "$devnull"};
1586 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
1587 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
1588 0 local $/;
1589 0 $signed_data = <$fh>;
1590 0 close $fh;
1591 0 File::Path::rmtree($tempdir);
1592 } else {
1593 0 my $fh = FileHandle->new;
1594 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
1595 0 local($/);
1596 0 $signed_data = <$fh>;
1597 } else {
1598 0 $CPAN::Frontend->mydie("Could not open $chk_file for reading");
1599 }
1600 0 close $fh;
1601 }
1602 0 $signed_data =~ s/\015?\012/\n/g;
1603 0 my($compmt) = Safe->new();
1604 0 $cksum = $compmt->reval($signed_data);
1605 0 ▶ if ($@) {
Branch: 2 branches
BranchTrueFalseTotal
if ($@) 0 7 7
if ($@) 0 0 0
1606 0 rename $chk_file, "$chk_file.bad";
1607 0 ▶ Carp::confess($@) if $@;
Branch: 2 branches
BranchTrueFalseTotal
if $@ 0 0 0
if $@ 0 0 0
1608 }
1609  
1610 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
1611 0 $CPAN::Frontend->mywarn(qq{
1612 Warning: checksum file '$chk_file' broken.
1613  
1614 When trying to read that file I expected to get a hash reference
1615 for further processing, but got garbage instead.
1616 });
1617 0 my $answer = CPAN::Shell::colorable_makemaker_prompt("Proceed nonetheless?", "no");
1618 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
1619 0 $self->{CHECKSUM_STATUS} = "NIL -- CHECKSUMS file broken";
1620 0 return;
1621 ▶ } 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
1622 0 $CPAN::Frontend->mywarn(qq{
1623 Warning: checksum file '$chk_file' not conforming.
1624  
1625 The cksum does not contain the key 'cpan_path' for '$basename'.
1626 });
1627 0 my $answer = CPAN::Shell::colorable_makemaker_prompt("Proceed nonetheless?", "no");
1628 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
1629 0 $self->{CHECKSUM_STATUS} = "NIL -- CHECKSUMS file without cpan_path";
1630 0 return;
1631 ▶ } 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
1632 ne $cksum->{$basename}{cpan_path}) {
1633 0 $CPAN::Frontend->mywarn(qq{
1634 Warning: checksum file not matching path '$self->{ID}'.
1635  
1636 The cksum contain the key 'cpan_path=$cksum->{$basename}{cpan_path}'
1637 which does not match the ID of the distribution '$self->{ID}'.
1638 Something's suspicious might be going on here. Please investigate.
1639  
1640 });
1641 0 my $answer = CPAN::Shell::colorable_makemaker_prompt("Proceed nonetheless?", "no");
1642 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
1643 0 $self->{CHECKSUM_STATUS} = "NIL -- CHECKSUMS non-matching cpan_path vs. ID";
1644 0 return;
1645 } elsif (exists $cksum->{$basename}{sha256}) {
1646 0 ▶ $self->debug("Found checksum for $basename:" .
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
if $CPAN::DEBUG 0 0 0
1647 "$cksum->{$basename}{sha256}\n") if $CPAN::DEBUG;
1648  
1649 0 open($fh, $file);
1650 0 binmode $fh;
1651 0 my $eq = $self->eq_CHECKSUM($fh,$cksum->{$basename}{sha256});
1652 0 $fh->close;
1653 0 $fh = CPAN::Tarzip->TIEHANDLE($file);
1654  
1655 0 ▶ unless ($eq) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($eq) 0 7 7
unless ($eq) 0 0 0
1656 0 my $dg = Digest::SHA->new(256);
1657 0 my($data,$ref);
1658 0 $ref = \$data;
1659 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
1660 0 $dg->add($data);
1661 }
1662 0 my $hexdigest = $dg->hexdigest;
1663 0 $eq += $hexdigest eq $cksum->{$basename}{'sha256-ungz'};
1664 }
1665  
1666 0 ▶ if ($eq) {
Branch: 2 branches
BranchTrueFalseTotal
if ($eq) { } 7 0 7
if ($eq) { } 0 0 0
1667 0 $CPAN::Frontend->myprint("Checksum for $file ok\n");
1668 0 return $self->{CHECKSUM_STATUS} = "OK";
1669 } else {
1670 0 $CPAN::Frontend->myprint(qq{\nChecksum mismatch for }.
1671 qq{distribution file. }.
1672 qq{Please investigate.\n\n}.
1673 $self->as_string,
1674 $CPAN::META->instance(
1675 'CPAN::Author',
1676 $self->cpan_userid
1677 )->as_string);
1678  
1679 0 my $wrap = qq{I\'d recommend removing $file. Its
1680 checksum is incorrect. Maybe you have configured your 'urllist' with
1681 a bad URL. Please check this array with 'o conf urllist', and
1682 retry.};
1683  
1684 0 $CPAN::Frontend->mydie(Text::Wrap::wrap("","",$wrap));
1685  
1686 # former versions just returned here but this seems a
1687 # serious threat that deserves a die
1688  
1689 # $CPAN::Frontend->myprint("\n\n");
1690 # sleep 3;
1691 # return;
1692 }
1693 # close $fh if fileno($fh);
1694 } else {
1695 0 ▶ return if $sloppy;
Branch: 2 branches
BranchTrueFalseTotal
if $sloppy 0 0 0
if $sloppy 0 0 0
1696 0 ▶ unless ($self->{CHECKSUM_STATUS}) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($self->{"CHECKSUM_STATUS"}) 0 0 0
unless ($self->{"CHECKSUM_STATUS"}) 0 0 0
1697 0 $CPAN::Frontend->mywarn(qq{
1698 Warning: No checksum for $basename in $chk_file.
1699  
1700 The cause for this may be that the file is very new and the checksum
1701 has not yet been calculated, but it may also be that something is
1702 going awry right now.
1703 });
1704 0 my $answer = CPAN::Shell::colorable_makemaker_prompt("Proceed?", "yes");
1705 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
1706 }
1707 0 $self->{CHECKSUM_STATUS} = "NIL -- distro not in CHECKSUMS file";
1708 0 return;
1709 }
1710 }
1711  
1712 #-> sub CPAN::Distribution::eq_CHECKSUM ;
1713 7 ▶sub eq_CHECKSUM {
Subroutine eq_CHECKSUM: called CC=3 SCAR=15.5
Pod undocumented
1714 0 ▶ my($self,$fh,$expect) = @_;
Subroutine eq_CHECKSUM: not called CC=3 SCAR=15.5
Pod undocumented
1715 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
1716 0 my $dg = Digest::SHA->new(256);
1717 0 my($data);
1718 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
1719 0 $dg->add($data);
1720 }
1721 0 my $hexdigest = $dg->hexdigest;
1722 # warn "fh[$fh] hex[$hexdigest] aexp[$expectMD5]";
1723 0 return $hexdigest eq $expect;
1724 }
1725 0 return 1;
1726 }
1727  
1728 #-> sub CPAN::Distribution::force ;
1729  
1730 # Both CPAN::Modules and CPAN::Distributions know if "force" is in
1731 # effect by autoinspection, not by inspecting a global variable. One
1732 # of the reason why this was chosen to work that way was the treatment
1733 # of dependencies. They should not automatically inherit the force
1734 # status. But this has the downside that ^C and die() will return to
1735 # the prompt but will not be able to reset the force_update
1736 # attributes. We try to correct for it currently in the read_metadata
1737 # routine, and immediately before we check for a Signal. I hope this
1738 # works out in one of v1.57_53ff
1739  
1740 # "Force get forgets previous error conditions"
1741  
1742 #-> sub CPAN::Distribution::fforce ;
1743 0 ▶sub fforce {
Subroutine fforce: not called CC=1 SCAR=6.9
Pod undocumented
1744 0 ▶ my($self, $method) = @_;
Subroutine fforce: not called CC=1 SCAR=6.9
Pod undocumented
1745 0 $self->force($method,1);
1746 }
1747  
1748 #-> sub CPAN::Distribution::force ;
1749 0 ▶sub force {
Subroutine force: not called CC=22 SCAR=62.3
Pod undocumented
1750 0 ▶ my($self, $method,$fforce) = @_;
Subroutine force: not called CC=22 SCAR=62.3
Pod undocumented
1751 0 my %phase_map = (
1752 get => [
1753 "unwrapped",
1754 "build_dir",
1755 "archived",
1756 "localfile",
1757 "CHECKSUM_STATUS",
1758 "signature_verify",
1759 "prefs",
1760 "prefs_file",
1761 "prefs_file_doc",
1762 "cleanup_after_install_done",
1763 ],
1764 make => [
1765 "writemakefile",
1766 "make",
1767 "modulebuild",
1768 "prereq_pm",
1769 "cleanup_after_install_done",
1770 ],
1771 test => [
1772 "badtestcnt",
1773 "make_test",
1774 "cleanup_after_install_done",
1775 ],
1776 install => [
1777 "install",
1778 "cleanup_after_install_done",
1779 ],
1780 unknown => [
1781 "reqtype",
1782 "yaml_content",
1783 "cleanup_after_install_done",
1784 ],
1785 );
1786 0 my $methodmatch = 0;
1787 0 my $ldebug = 0;
1788 0 PHASE: for my $phase (qw(unknown get make test install)) { # order matters
1789 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
1790 0 ▶ next unless $methodmatch;
Branch: 2 branches
BranchTrueFalseTotal
unless $methodmatch 0 0 0
unless $methodmatch 0 0 0
1791 0 ATTRIBUTE: for my $att (@{$phase_map{$phase}}) {
1792 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
1793 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
1794 && $att =~ /(unwrapped|build_dir|archived)/ ) {
1795 # cannot be undone for local distros
1796 0 next ATTRIBUTE;
1797 }
1798 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
1799 && $self->{build_dir}
1800 && $CPAN::META->{is_tested}
1801 ) {
1802 0 delete $CPAN::META->{is_tested}{$self->{build_dir}};
1803 }
1804 } elsif ($phase eq "test") {
1805 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
1806 && $self->{make_test}
1807 && $self->{make_test}{COMMANDID}
1808 && $self->{make_test}{COMMANDID} == $CPAN::CurrentCommandId
1809 ) {
1810 # endless loop too likely
1811 0 next ATTRIBUTE;
1812 }
1813 }
1814 0 delete $self->{$att};
1815 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
1816 # local $CPAN::DEBUG = 16; # Distribution
1817 0 CPAN->debug(sprintf "id[%s]phase[%s]att[%s]", $self->id, $phase, $att);
1818 }
1819 }
1820 }
1821 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
1822 0 $self->{force_update} = 1; # name should probably have been force_install
1823 }
1824 }
1825  
1826 #-> sub CPAN::Distribution::notest ;
1827 0 ▶sub notest {
Subroutine notest: not called CC=1 SCAR=6.9
Pod undocumented
1828 0 ▶ my($self, $method) = @_;
Subroutine notest: not called CC=1 SCAR=6.9
Pod undocumented
1829 # $CPAN::Frontend->mywarn("XDEBUG: set notest for $self $method");
1830 0 $self->{"notest"}++; # name should probably have been force_install
1831 }
1832  
1833 #-> sub CPAN::Distribution::unnotest ;
1834 0 ▶sub unnotest {
Subroutine unnotest: not called CC=1 SCAR=6.9
Pod undocumented
1835 0 ▶ my($self) = @_;
Subroutine unnotest: not called CC=1 SCAR=6.9
Pod undocumented
1836 # warn "XDEBUG: deleting notest";
1837 0 delete $self->{notest};
1838 }
1839  
1840 #-> sub CPAN::Distribution::unforce ;
1841 0 ▶sub unforce {
Subroutine unforce: not called CC=1 SCAR=6.9
Pod undocumented
1842 0 ▶ my($self) = @_;
Subroutine unforce: not called CC=1 SCAR=6.9
Pod undocumented
1843 0 delete $self->{force_update};
1844 }
1845  
1846 #-> sub CPAN::Distribution::isa_perl ;
1847 8 ▶sub isa_perl {
Subroutine isa_perl: called CC=5 SCAR=29.7
Pod undocumented
1848 0 ▶ my($self) = @_;
Subroutine isa_perl: not called CC=5 SCAR=29.7
Pod undocumented
1849 0 my $file = File::Basename::basename($self->id);
1850 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
1851 (
1852 -(5\.\d+\.\d+)
1853 |
1854 (5)[._-](00[0-5](?:_[0-4][0-9])?)
1855 )
1856 \.tar[._-](?:gz|bz2)
1857 (?!\n)\Z
1858 }xs) {
1859 0 my $perl_version;
1860 0 ▶ if ($2) {
Branch: 2 branches
BranchTrueFalseTotal
if ($2) { } 0 0 0
if ($2) { } 0 0 0
1861 0 $perl_version = $2;
1862 } else {
1863 0 $perl_version = "$3.$4";
1864 }
1865 0 return $perl_version;
1866 ▶ } 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
1867 &&
1868 $self->cpan_comment =~ /isa_perl\(.+?\)/) {
1869 0 return $1;
1870 }
1871 }
1872  
1873  
1874 #-> sub CPAN::Distribution::perl ;
1875 7 ▶sub perl {
Subroutine perl: called CC=2 SCAR=9.6
Pod undocumented
1876 0 ▶ my ($self) = @_;
Subroutine perl: not called CC=2 SCAR=9.6
Pod undocumented
1877 0 ▶ if (! $self) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($self) 0 7 7
unless ($self) 0 0 0
1878 26 ▶ use Carp qw(carp);
Subroutine BEGIN: called CC=1 SCAR=0.0
1879 0 carp __PACKAGE__ . "::perl was called without parameters.";
1880 }
1881 0 return CPAN::HandleConfig->safe_quote($CPAN::Perl);
1882 }
1883  
1884 #-> sub CPAN::Distribution::shortcut_prepare ;
1885 # return values: undef means don't shortcut; 0 means shortcut as fail;
1886 # and 1 means shortcut as success
1887  
1888 7 ▶sub shortcut_prepare {
Subroutine shortcut_prepare: called CC=21 SCAR=55.0
Pod undocumented
1889 0 ▶ my ($self) = @_;
Subroutine shortcut_prepare: not called CC=21 SCAR=55.0
Pod undocumented
1890  
1891 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
1892 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
1893 0 return $self->goodbye("Is neither a tar nor a zip archive.");
1894 }
1895  
1896 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
1897 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
1898 || (
1899 UNIVERSAL::can($self->{unwrapped},"failed") ?
1900 $self->{unwrapped}->failed :
1901 $self->{unwrapped} =~ /^NO/
1902 )) {
1903 0 return $self->goodbye("Had problems unarchiving. Please build manually");
1904 }
1905  
1906 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
1907 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
1908 && exists $self->{signature_verify}
1909 && (
1910 UNIVERSAL::can($self->{signature_verify},"failed") ?
1911 $self->{signature_verify}->failed :
1912 $self->{signature_verify} =~ /^NO/
1913 )
1914 ) {
1915 0 return $self->goodbye("Did not pass the signature test.");
1916 }
1917  
1918 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
1919 0 ▶ if ($self->{writemakefile}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{"writemakefile"}) 0 7 7
if ($self->{"writemakefile"}) 0 0 0
1920 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
1921 UNIVERSAL::can($self->{writemakefile},"failed") ?
1922 $self->{writemakefile}->failed :
1923 $self->{writemakefile} =~ /^NO/
1924 ) {
1925 # XXX maybe a retry would be in order?
1926 my $err = UNIVERSAL::can($self->{writemakefile},"text") ?
1927 $self->{writemakefile}->text :
1928 0 ▶ $self->{writemakefile};
Branch: 2 branches
BranchTrueFalseTotal
UNIVERSAL::can($self->{'writemakefile'}, 'text') ? : 0 0 0
UNIVERSAL::can($self->{'writemakefile'}, 'text') ? : 0 0 0
1929 0 $err =~ s/^NO\s*(--\s+)?//;
1930 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
1931 0 $err .= ", not re-running";
1932 0 return $self->goodbye($err);
1933 } else {
1934 0 return $self->success("Has already been prepared");
1935 }
1936 }
1937  
1938 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
1939 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
1940 0 return $self->goodbye($later);
1941 }
1942  
1943 0 return undef; # no shortcut
1944 }
1945  
1946 7 ▶sub prepare {
Subroutine prepare: called CC=63 SCAR=76.6
Pod undocumented
1947 0 ▶ my ($self) = @_;
Subroutine prepare: not called CC=63 SCAR=76.6
Pod undocumented
1948  
1949 0 ▶ $self->get
Branch: 2 branches
BranchTrueFalseTotal
$self->get or return 7 0 7
$self->get or return 0 0 0
1950 or return;
1951  
1952 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
1953 0 return $sc;
1954 }
1955  
1956 local $ENV{PERL5LIB} = defined($ENV{PERL5LIB})
1957 ? $ENV{PERL5LIB}
1958 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
1959 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
1960 local $ENV{PERL_USE_UNSAFE_INC} =
1961 exists $ENV{PERL_USE_UNSAFE_INC} && defined $ENV{PERL_USE_UNSAFE_INC}
1962 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
1963 0 $CPAN::META->set_perl5lib;
1964 0 local $ENV{MAKEFLAGS}; # protect us from outer make calls
1965  
1966 0 ▶ if ($CPAN::Signal) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Signal) 0 7 7
if ($CPAN::Signal) 0 0 0
1967 0 delete $self->{force_update};
1968 0 return;
1969 }
1970  
1971 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
1972 $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n");
1973  
1974 0 ▶ unless (chdir $builddir) {
Branch: 2 branches
BranchTrueFalseTotal
unless (CPAN::Distribution::chdir($builddir)) 0 7 7
unless (CPAN::Distribution::chdir($builddir)) 0 0 0
1975 0 $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!");
1976 0 return;
1977 }
1978  
1979 0 ▶ if ($CPAN::Signal) {
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::Signal) 0 7 7
if ($CPAN::Signal) 0 0 0
1980 0 delete $self->{force_update};
1981 0 return;
1982 }
1983  
1984 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
1985  
1986 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
1987 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
1988 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
1989 or return;
1990  
1991 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
1992 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
1993 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
1994 }
1995  
1996 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
1997 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
1998 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
1999 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
2000  
2001 0 ▶ if ($CPAN::DEBUG){
Branch: 2 branches
BranchTrueFalseTotal
if ($CPAN::DEBUG) 0 7 7
if ($CPAN::DEBUG) 0 0 0
2002 0 ▶ my $si = $self->{static_install} // "<undef>";
Condition0%0/4
$self->{"static_install"} // "<undef>"
l!l
00
$self->{"static_install"} // "<undef>"
l!l
00
MC/DC0%0/1
$self->{"static_install"} // "<undef>"
$self->{"static_install"}
MC/DC0%0/1
$self->{"static_install"} // "<undef>"
$self->{"static_install"}
Truth table0%0/2
A
A= $self->{"static_install"}
Aresult
11
00
Truth table0%0/2
A
A= $self->{"static_install"}
Aresult
11
00
2003 0 CPAN->debug("(in prepare) for $self->{ID} with static_install=$si");
2004 }
2005 0 ▶ if ($self->{static_install}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'static_install'}) { } 0 7 7
if ($self->{'static_install'}) { } 0 0 0
2006 0 $CPAN::Frontend->myprint("Configuring ".$self->id." with static install\n");
2007 0 my $args = $CPAN::Config->{'mbuildpl_arg'};
2008 0 my %opts = CPAN::Static::Install::opts_from_args_string($args);
2009 0 CPAN::Static::Install::configure(%opts);
2010 } else {
2011 my $configurator = $self->{configure} ? "Configure"
2012 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
2013 : "Makefile.PL";
2014  
2015 0 $CPAN::Frontend->myprint("Configuring ".$self->id." with $configurator\n");
2016  
2017 0 my $system;
2018 my $pl_commandline;
2019 0 ▶ if ($self->prefs->{pl}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->prefs->{"pl"}) 0 7 7
if ($self->prefs->{"pl"}) 0 0 0
2020 0 $pl_commandline = $self->prefs->{pl}{commandline};
2021 }
2022 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
2023 0 $system = $pl_commandline;
2024 0 $ENV{PERL} = $^X;
2025 } elsif ($self->{'configure'}) {
2026 0 $system = $self->{'configure'};
2027 } elsif ($self->{modulebuild}) {
2028 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
2029 0 my $mbuildpl_arg = $self->_make_phase_arg("pl");
2030 0 ▶ $system = sprintf("%s Build.PL%s",
Branch: 2 branches
BranchTrueFalseTotal
$mbuildpl_arg ? : 0 0 0
$mbuildpl_arg ? : 0 0 0
2031 $perl,
2032 $mbuildpl_arg ? " $mbuildpl_arg" : "",
2033 );
2034 } else {
2035 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
2036 0 my $switch = "";
2037 # This needs a handler that can be turned on or off:
2038 # $switch = "-MExtUtils::MakeMaker ".
2039 # "-Mops=:default,:filesys_read,:filesys_open,require,chdir"
2040 # if $] > 5.00310;
2041 0 my $makepl_arg = $self->_make_phase_arg("pl");
2042 $ENV{PERL5_CPAN_IS_EXECUTING} = File::Spec->catfile($self->{build_dir},
2043 0 "Makefile.PL");
2044 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
2045 $perl,
2046 $switch ? " $switch" : "",
2047 $makepl_arg ? " $makepl_arg" : "",
2048 );
2049 }
2050 0 my $pl_env;
2051 0 ▶ if ($self->prefs->{pl}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->prefs->{"pl"}) 0 7 7
if ($self->prefs->{"pl"}) 0 0 0
2052 0 $pl_env = $self->prefs->{pl}{env};
2053 }
2054 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
2055 0 ▶ if (exists $self->{writemakefile}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $self->{'writemakefile'}) { } 0 7 7
if (exists $self->{'writemakefile'}) { } 0 0 0
2056 } else {
2057 0 ▶ local($SIG{ALRM}) = sub { die "inactivity_timeout reached\n" };
Subroutine __ANON__: not called CC=1 SCAR=2.6
2058 0 my($ret,$pid,$output);
2059 0 $@ = "";
2060 0 my $go_via_alarm;
2061 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
2062 0 require Config;
2063 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
2064 &&
2065 $Config::Config{d_alarm} eq "define"
2066 ) {
2067 0 $go_via_alarm++
2068 } else {
2069 0 $CPAN::Frontend->mywarn("Warning: you have configured the config ".
2070 "variable 'inactivity_timeout' to ".
2071 "'$CPAN::Config->{inactivity_timeout}'. But ".
2072 "on this machine the system call 'alarm' ".
2073 "isn't available. This means that we cannot ".
2074 "provide the feature of intercepting long ".
2075 "waiting code and will turn this feature off.\n"
2076 );
2077 0 $CPAN::Config->{inactivity_timeout} = 0;
2078 }
2079 }
2080 0 ▶ if ($go_via_alarm) {
Branch: 2 branches
BranchTrueFalseTotal
if ($go_via_alarm) { } 0 7 7
if ($go_via_alarm) { } 0 0 0
2081 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
2082 ($output, $ret) = CPAN::Reporter::record_command(
2083 $system,
2084 $CPAN::Config->{inactivity_timeout},
2085 0 );
2086 0 CPAN::Reporter::grade_PL( $self, $system, $output, $ret );
2087 }
2088 else {
2089 0 eval {
2090 0 alarm $CPAN::Config->{inactivity_timeout};
2091 0 local $SIG{CHLD}; # = sub { wait };
2092 0 ▶ if (defined($pid = fork)) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined($pid = fork)) { } 0 0 0
if (defined($pid = fork)) { } 0 0 0
2093 0 ▶ if ($pid) { #parent
Branch: 2 branches
BranchTrueFalseTotal
if ($pid) { } 0 0 0
if ($pid) { } 0 0 0
2094 # wait;
2095 0 waitpid $pid, 0;
2096 } else { #child
2097 # note, this exec isn't necessary if
2098 # inactivity_timeout is 0. On the Mac I'd
2099 # suggest, we set it always to 0.
2100 0 exec $system;
2101 }
2102 } else {
2103 0 $CPAN::Frontend->myprint("Cannot fork: $!");
2104 0 return;
2105 }
2106 };
2107 0 alarm 0;
2108 0 ▶ if ($@) {
Branch: 2 branches
BranchTrueFalseTotal
if ($@) 0 0 0
if ($@) 0 0 0
2109 0 kill 9, $pid;
2110 0 waitpid $pid, 0;
2111 0 my $err = "$@";
2112 0 $CPAN::Frontend->myprint($err);
2113 0 $self->{writemakefile} = CPAN::Distrostatus->new("NO $err");
2114 0 $@ = "";
2115 0 $self->store_persistent_state;
2116 0 return $self->goodbye("$system -- TIMED OUT");
2117 }
2118 }
2119 } else {
2120 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
2121 # XXX probably want to check _should_report here and warn
2122 # about not being able to use CPAN::Reporter with expect
2123 0 $ret = $self->_run_via_expect($system,'writemakefile',$expect_model);
2124 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
2125 && $self->{writemakefile}
2126 && $self->{writemakefile}->failed) {
2127 # timeout
2128 0 return;
2129 }
2130 }
2131 elsif ( $self->_should_report('pl') ) {
2132 0 ($output, $ret) = eval { CPAN::Reporter::record_command($system) };
2133 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
2134 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
2135 0 $CPAN::Frontend->mywarn("Error while running PL phase: $err\n");
2136 0 $self->{writemakefile} = CPAN::Distrostatus
2137 ->new("NO '$system' returned status $ret and no output");
2138 0 return $self->goodbye("$system -- NOT OK");
2139 }
2140 0 CPAN::Reporter::grade_PL( $self, $system, $output, $ret );
2141 }
2142 else {
2143 0 $ret = system($system);
2144 }
2145 0 ▶ if ($ret != 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ret != 0) 3 4 7
if ($ret != 0) 0 0 0
2146 0 $self->{writemakefile} = CPAN::Distrostatus
2147 ->new("NO '$system' returned status $ret");
2148 0 $CPAN::Frontend->mywarn("Warning: No success on command[$system]\n");
2149 0 $self->store_persistent_state;
2150 0 return $self->goodbye("$system -- NOT OK");
2151 }
2152 }
2153 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
2154 0 $self->{writemakefile} = CPAN::Distrostatus->new("YES");
2155 0 delete $self->{make_clean}; # if cleaned before, enable next
2156 0 $self->store_persistent_state;
2157 0 return $self->success("$system -- OK");
2158 } else {
2159 0 ▶ my $makefile = $self->{modulebuild} ? "Build" : "Makefile";
Branch: 2 branches
BranchTrueFalseTotal
$self->{'modulebuild'} ? : 0 0 0
$self->{'modulebuild'} ? : 0 0 0
2160 0 my $why = "No '$makefile' created";
2161 0 $CPAN::Frontend->mywarn($why);
2162 0 $self->{writemakefile} = CPAN::Distrostatus
2163 ->new(qq{NO -- $why\n});
2164 0 $self->store_persistent_state;
2165 0 return $self->goodbye("$system -- NOT OK");
2166 }
2167 }
2168 0 $self->store_persistent_state;
2169 }
2170 0 return 1; # success
2171 }
2172  
2173 #-> sub CPAN::Distribution::shortcut_make ;
2174 # return values: undef means don't shortcut; 0 means shortcut as fail;
2175 # and 1 means shortcut as success
2176 4 ▶sub shortcut_make {
Subroutine shortcut_make: called CC=7 SCAR=32.9
Pod undocumented
2177 4 my ($self) = @_;
2178  
2179 4 ▶ $self->debug("checking make/build results[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 4 4
2180 4 ▶ if (defined $self->{make}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"make"}) 0 4 4
2181 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
2182 $self->{make}->failed :
2183 $self->{make} =~ /^NO/
2184 ) {
2185 0 ▶ if ($self->{force_update}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'force_update'}) { } 0 0 0
2186 # Trying an already failed 'make' (unless somebody else blocks)
2187 0 return undef; # no shortcut
2188 } else {
2189 # introduced for turning recursion detection into a distrostatus
2190 my $error = length $self->{make}>3
2191 0 ▶ ? substr($self->{make},3) : "Unknown error";
Branch: 1 branch
BranchTrueFalseTotal
length $self->{'make'} > 3 ? : 0 0 0
2192 0 $self->store_persistent_state;
2193 0 return $self->goodbye("Could not make: $error\n");
2194 }
2195 } else {
2196 0 return $self->success("Has already been made")
2197 }
2198 }
2199 4 return undef; # no shortcut
2200 }
2201  
2202 #-> sub CPAN::Distribution::make ;
2203 7 ▶sub make {
Subroutine make: called CC=48 SCAR=59.3
Pod undocumented
2204 7 my($self) = @_;
2205  
2206 7 $self->pre_make();
2207  
2208 7 ▶ if (exists $self->{cleanup_after_install_done}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"cleanup_after_install_done"}) 0 7 7
2209 0 $self->post_make();
2210 0 return $self->get;
2211 }
2212  
2213 7 ▶ $self->debug("checking goto id[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
2214 7 ▶ if (my $goto = $self->prefs->{goto}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $goto = $self->prefs->{"goto"}) 0 7 7
2215 0 $self->post_make();
2216 0 return $self->goto($goto);
2217 }
2218 # Emergency brake if they said install Pippi and get newest perl
2219  
2220 # XXX Would this make more sense in shortcut_prepare, since
2221 # that doesn't make sense on a perl dist either? Broader
2222 # question: what is the purpose of suggesting force install
2223 # on a perl distribution? That seems unlikely to result in
2224 # such a dependency being satisfied, even if the perl is
2225 # successfully installed. This situation is tantamount to
2226 # a prereq on a version of perl greater than the current one
2227 # so I think we should just abort. -- xdg, 2012-04-06
2228 7 ▶ if ($self->isa_perl) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->isa_perl) 0 7 7
2229 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
2230 $self->called_for ne $self->id &&
2231 ! $self->{force_update}
2232 ) {
2233 # if we die here, we break bundles
2234 0 $CPAN::Frontend
2235 ->mywarn(sprintf(
2236 qq{The most recent version "%s" of the module "%s"
2237 is part of the perl-%s distribution. To install that, you need to run
2238 force install %s --or--
2239 install %s
2240 },
2241 $CPAN::META->instance(
2242 'CPAN::Module',
2243 $self->called_for
2244 )->cpan_version,
2245 $self->called_for,
2246 $self->isa_perl,
2247 $self->called_for,
2248 $self->pretty_id,
2249 ));
2250 0 $self->{make} = CPAN::Distrostatus->new("NO isa perl");
2251 0 $CPAN::Frontend->mysleep(1);
2252 0 $self->post_make();
2253 0 return;
2254 }
2255 }
2256  
2257 7 ▶ unless ($self->prepare){
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->prepare) 3 4 7
2258 3 $self->post_make();
2259 3 return;
2260 }
2261  
2262 4 ▶ if ( defined( my $sc = $self->shortcut_make) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $sc = $self->shortcut_make)) 0 4 4
2263 0 $self->post_make();
2264 0 return $sc;
2265 }
2266  
2267 4 ▶ if ($CPAN::Signal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Signal) 0 4 4
2268 0 delete $self->{force_update};
2269 0 $self->post_make();
2270 0 return;
2271 }
2272  
2273 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
2274 $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n");
2275  
2276 4 ▶ unless (chdir $builddir) {
Branch: 1 branch
BranchTrueFalseTotal
unless (CPAN::Distribution::chdir($builddir)) 0 4 4
2277 0 $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!");
2278 0 $self->post_make();
2279 0 return;
2280 }
2281  
2282 4 ▶ CPAN->debug("(in make) have changed to $builddir") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 4 4
2283 4 ▶ my $make = $self->{modulebuild} ? "Build" : "make";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'modulebuild'} ? : 0 4 4
2284 4 $CPAN::Frontend->myprint(sprintf "Running %s for %s\n", $make, $self->id);
2285 local $ENV{PERL5LIB} = defined($ENV{PERL5LIB})
2286 ? $ENV{PERL5LIB}
2287 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
2288 4 ▶ local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : "";
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL5OPT'} ? : 4 0 4
2289 local $ENV{PERL_USE_UNSAFE_INC} =
2290 exists $ENV{PERL_USE_UNSAFE_INC} && defined $ENV{PERL_USE_UNSAFE_INC}
2291 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
2292 4 $CPAN::META->set_perl5lib;
2293 4 local $ENV{MAKEFLAGS}; # protect us from outer make calls
2294  
2295 4 ▶ if ($CPAN::Signal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Signal) 0 4 4
2296 0 delete $self->{force_update};
2297 0 $self->post_make();
2298 0 return;
2299 }
2300  
2301 4 my %env;
2302 4 ▶ while (my($k,$v) = each %ENV) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %ENV) 148 4 152
2303 148 ▶ next if defined $v;
Branch: 1 branch
BranchTrueFalseTotal
if defined $v 144 4 148
2304 4 $env{$k} = '';
2305 }
2306 4 local @ENV{keys %env} = values %env;
2307 4 my $satisfied = eval { $self->satisfy_requires };
2308 4 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 4 4
2309 0 return $self->goodbye($@);
2310 }
2311 4 ▶ unless ($satisfied){
Branch: 1 branch
BranchTrueFalseTotal
unless ($satisfied) 0 4 4
2312 0 $self->post_make();
2313 0 return;
2314 }
2315 4 ▶ if ($CPAN::Signal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Signal) 0 4 4
2316 0 delete $self->{force_update};
2317 0 $self->post_make();
2318 0 return;
2319 }
2320  
2321 # need to chdir again, because $self->satisfy_requires might change the directory
2322 4 ▶ unless (chdir $builddir) {
Branch: 1 branch
BranchTrueFalseTotal
unless (CPAN::Distribution::chdir($builddir)) 0 4 4
2323 0 $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!");
2324 0 $self->post_make();
2325 0 return;
2326 }
2327  
2328 4 ▶ local $ENV{PERL} = defined $ENV{PERL}? $ENV{PERL} : $^X;
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL'} ? : 0 4 4
2329 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
2330 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
2331  
2332 4 my $system_ok;
2333 4 ▶ if ($self->{static_install}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'static_install'}) { } 0 4 4
2334 0 my $args = $CPAN::Config->{'mbuild_arg'};
2335 0 my %opts = CPAN::Static::Install::opts_from_args_string($args);
2336 0 CPAN::Static::Install::build(%opts);
2337 0 $system_ok = 1;
2338 } else {
2339 4 my $system;
2340 my $make_commandline;
2341 4 ▶ if ($self->prefs->{make}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->prefs->{"make"}) 0 4 4
2342 0 $make_commandline = $self->prefs->{make}{commandline};
2343 }
2344 4 ▶ if ($make_commandline) {
Branch: 1 branch
BranchTrueFalseTotal
if ($make_commandline) { } 0 4 4
2345 0 $system = $make_commandline;
2346 0 $ENV{PERL} = CPAN::find_perl();
2347 } else {
2348 4 ▶ if ($self->{modulebuild}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'modulebuild'}) { } 0 4 4
2349 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
2350 0 my $cwd = CPAN::anycwd();
2351 0 $CPAN::Frontend->mywarn("Alert: no Build file available for 'make $self->{id}'".
2352 " in cwd[$cwd]. Danger, Will Robinson!\n");
2353 0 $CPAN::Frontend->mysleep(5);
2354 }
2355 0 $system = join " ", $self->_build_command(), $CPAN::Config->{mbuild_arg};
2356 } else {
2357 4 $system = join " ", $self->_make_command(), $CPAN::Config->{make_arg};
2358 }
2359 4 $system =~ s/\s+$//;
2360 4 my $make_arg = $self->_make_phase_arg("make");
2361 4 ▶ $system = sprintf("%s%s",
Branch: 1 branch
BranchTrueFalseTotal
$make_arg ? : 0 4 4
2362 $system,
2363 $make_arg ? " $make_arg" : "",
2364 );
2365 }
2366 4 my $make_env;
2367 4 ▶ if ($self->prefs->{make}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->prefs->{"make"}) 0 4 4
2368 0 $make_env = $self->prefs->{make}{env};
2369 }
2370 4 ▶ local @ENV{keys %$make_env} = values %$make_env if $make_env;
Branch: 1 branch
BranchTrueFalseTotal
if $make_env 0 4 4
2371 4 my $expect_model = $self->_prefs_with_expect("make");
2372 4 my $want_expect = 0;
2373 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
2374 0 my $can_expect = $CPAN::META->has_inst("Expect");
2375 0 ▶ if ($can_expect) {
Branch: 1 branch
BranchTrueFalseTotal
if ($can_expect) { } 0 0 0
2376 0 $want_expect = 1;
2377 } else {
2378 0 $CPAN::Frontend->mywarn("Expect not installed, falling back to ".
2379 "system()\n");
2380 }
2381 }
2382 4 my $system_err;
2383 4 ▶ if ($want_expect) {
Branch: 2 branches
BranchTrueFalseTotal
if ($want_expect) { } 0 4 4
elsif ($self->_should_report('make')) { } 0 4 4
2384 # XXX probably want to check _should_report here and
2385 # warn about not being able to use CPAN::Reporter with expect
2386 0 $system_ok = $self->_run_via_expect($system,'make',$expect_model) == 0;
2387 }
2388 elsif ( $self->_should_report('make') ) {
2389 0 my ($output, $ret) = CPAN::Reporter::record_command($system);
2390 0 CPAN::Reporter::grade_make( $self, $system, $output, $ret );
2391 0 $system_ok = ! $ret;
2392 }
2393 else {
2394 4 my $rc = system($system);
2395 4 $system_ok = $rc == 0;
2396 4 ▶ $system_err = $! if $rc == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $rc == -1 0 4 4
2397 }
2398 4 $self->introduce_myself;
2399 4 ▶ if ( $system_ok ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($system_ok) { } 4 0 4
2400 4 $CPAN::Frontend->myprint(" $system -- OK\n");
2401 4 $self->{make} = CPAN::Distrostatus->new("YES");
2402 } else {
2403 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
2404 0 $self->{make} = CPAN::Distrostatus->new("NO");
2405 0 $CPAN::Frontend->mywarn(" $system -- NOT OK\n");
2406 0 ▶ $CPAN::Frontend->mywarn(" $system_err\n") if defined $system_err;
Branch: 1 branch
BranchTrueFalseTotal
if defined $system_err 0 0 0
2407 }
2408 }
2409  
2410 4 $self->store_persistent_state;
2411  
2412 4 $self->post_make();
2413  
2414 4 return !! $system_ok;
2415 }
2416  
2417 # CPAN::Distribution::goodbye ;
2418 3 ▶sub goodbye {
Subroutine goodbye: called CC=1 SCAR=0.0
Pod undocumented
2419 3 my($self,$goodbye) = @_;
2420 3 my $id = $self->pretty_id;
2421 3 $CPAN::Frontend->mywarn(" $id\n $goodbye\n");
2422 3 return 0; # must be explicit false, not undef
2423 }
2424  
2425 4 ▶sub success {
Subroutine success: called CC=1 SCAR=0.0
Pod undocumented
2426 4 my($self,$why) = @_;
2427 4 my $id = $self->pretty_id;
2428 4 $CPAN::Frontend->myprint(" $id\n $why\n");
2429 4 return 1;
2430 }
2431  
2432 # CPAN::Distribution::_run_via_expect ;
2433 0 ▶sub _run_via_expect {
Subroutine _run_via_expect: not called CC=6 SCAR=37.4
2434 0 my($self,$system,$phase,$expect_model) = @_;
2435 0 ▶ CPAN->debug("system[$system]expect_model[$expect_model]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
2436 0 ▶ if ($CPAN::META->has_inst("Expect")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst('Expect')) { } 0 0 0
2437 0 my $expo = Expect->new; # expo Expect object;
2438 0 $expo->spawn($system);
2439 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
2440 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
2441 0 return $self->_run_via_expect_deterministic($expo,$phase,$expect_model);
2442 } elsif ($expect_model->{mode} eq "anyorder") {
2443 0 return $self->_run_via_expect_anyorder($expo,$phase,$expect_model);
2444 } else {
2445 0 die "Panic: Illegal expect mode: $expect_model->{mode}";
2446 }
2447 } else {
2448 0 $CPAN::Frontend->mywarn("Expect not installed, falling back to system()\n");
2449 0 return system($system);
2450 }
2451 }
2452  
2453 0 ▶sub _run_via_expect_anyorder {
Subroutine _run_via_expect_anyorder: not called CC=9 SCAR=45.0
2454 0 my($self,$expo,$phase,$expect_model) = @_;
2455 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
2456 0 my $reuse = $expect_model->{reuse};
2457 0 my @expectacopy = @{$expect_model->{talk}}; # we trash it!
2458 0 my $but = "";
2459 0 my $timeout_start = time;
2460 0 EXPECT: while () {
2461 0 my($eof,$ran_into_timeout);
2462 # XXX not up to the full power of expect. one could certainly
2463 # wrap all of the talk pairs into a single expect call and on
2464 # success tweak it and step ahead to the next question. The
2465 # current implementation unnecessarily limits itself to a
2466 # single match.
2467 my @match = $expo->expect(1,
2468 0 ▶ [ eof => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2469 0 $eof++;
2470 } ],
2471 0 ▶ [ timeout => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2472 0 $ran_into_timeout++;
2473 0 } ],
2474 -re => eval"qr{.}",
2475 );
2476 0 ▶ if ($match[2]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($match[2]) 0 0 0
2477 0 $but .= $match[2];
2478 }
2479 0 $but .= $expo->clear_accum;
2480 0 ▶ if ($eof) {
Branch: 2 branches
BranchTrueFalseTotal
if ($eof) { } 0 0 0
elsif ($ran_into_timeout) { } 0 0 0
2481 0 $expo->soft_close;
2482 0 return $expo->exitstatus();
2483 } elsif ($ran_into_timeout) {
2484 # warn "DEBUG: they are asking a question, but[$but]";
2485 0 ▶ for (my $i = 0; $i <= $#expectacopy; $i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#expectacopy) 0 0 0
2486 0 my($next,$send) = @expectacopy[$i,$i+1];
2487 0 my $regex = eval "qr{$next}";
2488 # warn "DEBUG: will compare with regex[$regex].";
2489 0 ▶ if ($but =~ /$regex/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($but =~ /$regex/) 0 0 0
2490 # warn "DEBUG: will send send[$send]";
2491 0 $expo->send($send);
2492 # never allow reusing an QA pair unless they told us
2493 0 ▶ splice @expectacopy, $i, 2 unless $reuse;
Branch: 1 branch
BranchTrueFalseTotal
unless $reuse 0 0 0
2494 0 $but =~ s/(?s:^.*?)$regex//;
2495 0 $timeout_start = time;
2496 0 next EXPECT;
2497 }
2498 }
2499 0 my $have_waited = time - $timeout_start;
2500 0 ▶ if ($have_waited < $timeout) {
Branch: 1 branch
BranchTrueFalseTotal
if ($have_waited < $timeout) 0 0 0
2501 # warn "DEBUG: have_waited[$have_waited]timeout[$timeout]";
2502 0 next EXPECT;
2503 }
2504 0 my $why = "could not answer a question during the dialog";
2505 0 $CPAN::Frontend->mywarn("Failing: $why\n");
2506 0 $self->{$phase} =
2507 CPAN::Distrostatus->new("NO $why");
2508 0 return 0;
2509 }
2510 }
2511 }
2512  
2513 0 ▶sub _run_via_expect_deterministic {
Subroutine _run_via_expect_deterministic: not called CC=6 SCAR=37.4
2514 0 my($self,$expo,$phase,$expect_model) = @_;
2515 0 my $ran_into_timeout;
2516 my $ran_into_eof;
2517 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
2518 0 my $expecta = $expect_model->{talk};
2519 0 ▶ EXPECT: for (my $i = 0; $i <= $#$expecta; $i+=2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $expecta->$#*) 0 0 0
2520 0 my($re,$send) = @$expecta[$i,$i+1];
2521 0 ▶ CPAN->debug("timeout[$timeout]re[$re]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
2522 0 my $regex = eval "qr{$re}";
2523 $expo->expect($timeout,
2524 0 ▶ [ eof => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2525 0 my $but = $expo->clear_accum;
2526 0 $CPAN::Frontend->mywarn("EOF (maybe harmless)
2527 expected[$regex]\nbut[$but]\n\n");
2528 0 $ran_into_eof++;
2529 } ],
2530 0 ▶ [ timeout => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2531 0 my $but = $expo->clear_accum;
2532 0 $CPAN::Frontend->mywarn("TIMEOUT
2533 expected[$regex]\nbut[$but]\n\n");
2534 0 $ran_into_timeout++;
2535 0 } ],
2536 -re => $regex);
2537 0 ▶ if ($ran_into_timeout) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ran_into_timeout) { } 0 0 0
elsif ($ran_into_eof) { } 0 0 0
2538 # note that the caller expects 0 for success
2539 0 $self->{$phase} =
2540 CPAN::Distrostatus->new("NO timeout during expect dialog");
2541 0 return 0;
2542 } elsif ($ran_into_eof) {
2543 0 last EXPECT;
2544 }
2545 0 $expo->send($send);
2546 }
2547 0 $expo->soft_close;
2548 0 return $expo->exitstatus();
2549 }
2550  
2551 #-> CPAN::Distribution::_validate_distropref
2552 0 ▶sub _validate_distropref {
Subroutine _validate_distropref: not called CC=5 SCAR=34.0
2553 0 my($self,@args) = @_;
2554 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
2555 $CPAN::META->has_inst("CPAN::Kwalify")
2556 &&
2557 $CPAN::META->has_inst("Kwalify")
2558 ) {
2559 0 eval {CPAN::Kwalify::_validate("distroprefs",@args);};
2560 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
2561 0 $CPAN::Frontend->mywarn($@);
2562 }
2563 } else {
2564 0 ▶ CPAN->debug("not validating '@args'") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
2565 }
2566 }
2567  
2568 #-> CPAN::Distribution::_find_prefs
2569 0 ▶sub _find_prefs {
Subroutine _find_prefs: not called CC=18 SCAR=58.3
2570 0 my($self) = @_;
2571 0 my $distroid = $self->pretty_id;
2572 #CPAN->debug("distroid[$distroid]") if $CPAN::DEBUG;
2573 0 my $prefs_dir = $CPAN::Config->{prefs_dir};
2574 0 ▶ return if $prefs_dir =~ /^\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
if $prefs_dir =~ /^\s*$/ 0 0 0
2575 0 eval { File::Path::mkpath($prefs_dir); };
2576 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
2577 0 $CPAN::Frontend->mydie("Cannot create directory $prefs_dir");
2578 }
2579 # shortcut if there are no distroprefs files
2580 {
2581 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
2582 0 my @files = map { /\.(yml|dd|st)\z/i } $dh->read;
2583 0 ▶ return unless @files;
Branch: 1 branch
BranchTrueFalseTotal
unless @files 0 0 0
2584 }
2585 0 my $yaml_module = CPAN::_yaml_module();
2586 0 my $ext_map = {};
2587 0 my @extensions;
2588 0 ▶ if ($CPAN::META->has_inst($yaml_module)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst($yaml_module)) { } 0 0 0
2589 0 $ext_map->{yml} = 'CPAN';
2590 } else {
2591 0 my @fallbacks;
2592 0 ▶ if ($CPAN::META->has_inst("Data::Dumper")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst("Data::Dumper")) 0 0 0
2593 0 push @fallbacks, $ext_map->{dd} = 'Data::Dumper';
2594 }
2595 0 ▶ if ($CPAN::META->has_inst("Storable")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst("Storable")) 0 0 0
2596 0 push @fallbacks, $ext_map->{st} = 'Storable';
2597 }
2598 0 ▶ if (@fallbacks) {
Branch: 1 branch
BranchTrueFalseTotal
if (@fallbacks) { } 0 0 0
2599 0 local $" = " and ";
2600 0 ▶ unless ($self->{have_complained_about_missing_yaml}++) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"have_complained_about_missing_yaml"}++) 0 0 0
2601 0 $CPAN::Frontend->mywarnonce("'$yaml_module' not installed, falling back ".
2602 "to @fallbacks to read prefs '$prefs_dir'\n");
2603 }
2604 } else {
2605 0 ▶ unless ($self->{have_complained_about_missing_yaml}++) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"have_complained_about_missing_yaml"}++) 0 0 0
2606 0 $CPAN::Frontend->mywarnonce("'$yaml_module' not installed, cannot ".
2607 "read prefs '$prefs_dir'\n");
2608 }
2609 }
2610 }
2611 0 my $finder = CPAN::Distroprefs->find($prefs_dir, $ext_map);
2612 0 ▶ DIRENT: while (my $result = $finder->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $result = $finder->next) 0 0 0
2613 0 ▶ if ($result->is_warning) {
Branch: 2 branches
BranchTrueFalseTotal
if ($result->is_warning) { } 0 0 0
elsif ($result->is_fatal) { } 0 0 0
2614 0 $CPAN::Frontend->mywarn($result->as_string);
2615 0 $CPAN::Frontend->mysleep(1);
2616 0 next DIRENT;
2617 } elsif ($result->is_fatal) {
2618 0 $CPAN::Frontend->mydie($result->as_string);
2619 }
2620  
2621 0 my @prefs = @{ $result->prefs };
2622  
2623 0 ELEMENT: for my $y (0..$#prefs) {
2624 0 my $pref = $prefs[$y];
2625 0 $self->_validate_distropref($pref->data, $result->abs, $y);
2626  
2627 # I don't know why we silently skip when there's no match, but
2628 # complain if there's an empty match hashref, and there's no
2629 # comment explaining why -- hdp, 2008-03-18
2630 0 ▶ unless ($pref->has_any_match) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($pref->has_any_match) 0 0 0
2631 0 next ELEMENT;
2632 }
2633  
2634 0 ▶ unless ($pref->has_valid_subkeys) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($pref->has_valid_subkeys) 0 0 0
2635 0 $CPAN::Frontend->mydie(sprintf
2636 "Nonconforming .%s file '%s': " .
2637 "missing match/* subattribute. " .
2638 "Please remove, cannot continue.",
2639 $result->ext, $result->abs,
2640 );
2641 }
2642  
2643 my $arg = {
2644 env => \%ENV,
2645 distribution => $distroid,
2646 perl => \&CPAN::find_perl,
2647 perlconfig => \%Config::Config,
2648 0 ▶ module => sub { [ $self->containsmods ] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
2649 0 };
2650  
2651 0 ▶ if ($pref->matches($arg)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pref->matches($arg)) 0 0 0
2652 return {
2653 0 prefs => $pref->data,
2654 prefs_file => $result->abs,
2655 prefs_file_doc => $y,
2656 };
2657 }
2658  
2659 }
2660 }
2661 0 return;
2662 }
2663  
2664 # CPAN::Distribution::prefs
2665 182 ▶sub prefs {
Subroutine prefs: called CC=11 SCAR=40.2
Pod undocumented
2666 182 my($self) = @_;
2667 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
2668 &&
2669 $self->{negative_prefs_cache} != $CPAN::CurrentCommandId
2670 ) {
2671 0 delete $self->{negative_prefs_cache};
2672 0 delete $self->{prefs};
2673 }
2674 182 ▶ if (exists $self->{prefs}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"prefs"}) 175 7 182
2675 175 return $self->{prefs}; # XXX comment out during debugging
2676 }
2677 7 ▶ if ($CPAN::Config->{prefs_dir}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"prefs_dir"}) 0 7 7
2678 0 ▶ CPAN->debug("prefs_dir[$CPAN::Config->{prefs_dir}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
2679 0 my $prefs = $self->_find_prefs();
2680 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
2681 0 ▶ CPAN->debug("prefs[$prefs]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
2682 0 ▶ if ($prefs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prefs) 0 0 0
2683 0 for my $x (qw(prefs prefs_file prefs_file_doc)) {
2684 0 $self->{$x} = $prefs->{$x};
2685 }
2686 my $bs = sprintf(
2687 "%s[%s]",
2688 File::Basename::basename($self->{prefs_file}),
2689 $self->{prefs_file_doc},
2690 0 );
2691 0 my $filler1 = "_" x 22;
2692 0 my $filler2 = int(66 - length($bs))/2;
2693 0 ▶ $filler2 = 0 if $filler2 < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $filler2 < 0 0 0 0
2694 0 $filler2 = " " x $filler2;
2695 0 my $pretty = $self->pretty_id;
2696 0 my $filler3 = int(66 - length($pretty))/2;
2697 0 $filler3 = " " x $filler3;
2698 0 $CPAN::Frontend->myprint("
2699 $filler1 D i s t r o P r e f s $filler1
2700 $filler2 $bs $filler2
2701 $filler3 $pretty $filler3
2702 ");
2703 0 $CPAN::Frontend->mysleep(1);
2704 0 return $self->{prefs};
2705 }
2706 }
2707 7 $self->{negative_prefs_cache} = $CPAN::CurrentCommandId;
2708 7 return $self->{prefs} = +{};
2709 }
2710  
2711 # CPAN::Distribution::_make_phase_arg
2712 15 ▶sub _make_phase_arg {
Subroutine _make_phase_arg: called CC=7 SCAR=23.3
2713 15 my($self, $phase) = @_;
2714 15 my $_make_phase_arg;
2715 15 my $prefs = $self->prefs;
2716 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
2717 $prefs
2718 && exists $prefs->{$phase}
2719 && exists $prefs->{$phase}{args}
2720 && $prefs->{$phase}{args}
2721 ) {
2722 $_make_phase_arg = join(" ",
2723 0 map {CPAN::HandleConfig
2724 0 ->safe_quote($_)} @{$prefs->{$phase}{args}},
2725 );
2726 }
2727  
2728 # cpan[2]> o conf make[TAB]
2729 # make make_install_make_command
2730 # make_arg makepl_arg
2731 # make_install_arg
2732 # cpan[2]> o conf mbuild[TAB]
2733 # mbuild_arg mbuild_install_build_command
2734 # mbuild_install_arg mbuildpl_arg
2735  
2736 15 my $mantra; # must switch make/mbuild here
2737 15 ▶ if ($self->{modulebuild}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'modulebuild'}) { } 0 15 15
2738 0 $mantra = "mbuild";
2739 } else {
2740 15 $mantra = "make";
2741 }
2742 15 my %map = (
2743 pl => "pl_arg",
2744 make => "_arg",
2745 test => "_test_arg", # does not really exist but maybe
2746 # will some day and now protects
2747 # us from unini warnings
2748 install => "_install_arg",
2749 );
2750 15 my $phase_underscore_meshup = $map{$phase};
2751 15 my $what = sprintf "%s%s", $mantra, $phase_underscore_meshup;
2752  
2753 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
2754 15 return $_make_phase_arg;
2755 }
2756  
2757 # CPAN::Distribution::_make_command
2758 9 ▶sub _make_command {
Subroutine _make_command: called CC=7 SCAR=31.7
2759 9 my ($self) = @_;
2760 9 ▶ if ($self) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self) { } 9 0 9
2761 return
2762 CPAN::HandleConfig
2763 ->safe_quote(
2764 CPAN::HandleConfig->prefs_lookup($self,
2765 q{make})
2766 || $Config::Config{make}
2767 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
2768 );
2769 } else {
2770 # Old style call, without object. Deprecated
2771 0 Carp::confess("CPAN::_make_command() used as function. Don't Do That.");
2772 return
2773 safe_quote(undef,
2774 CPAN::HandleConfig->prefs_lookup($self,q{make})
2775 || $CPAN::Config->{make}
2776 || $Config::Config{make}
2777 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
2778 }
2779 }
2780  
2781 1 ▶sub _make_install_make_command {
Subroutine _make_install_make_command: called CC=3 SCAR=15.1
2782 1 my ($self) = @_;
2783 1 my $mimc =
2784 CPAN::HandleConfig->prefs_lookup($self, q{make_install_make_command});
2785 1 ▶ return $self->_make_command() unless $mimc;
Branch: 1 branch
BranchTrueFalseTotal
unless $mimc 1 0 1
2786  
2787 # Quote the "make install" make command on Windows, where it is commonly
2788 # found in, e.g., C:\Program Files\... and therefore needs quoting. We can't
2789 # do this in general because the command maybe "sudo make..." (i.e. a
2790 # program with arguments), but that is unlikely to be the case on Windows.
2791 0 ▶ $mimc = CPAN::HandleConfig->safe_quote($mimc) if $^O eq 'MSWin32';
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "MSWin32" 0 0 0
2792  
2793 0 return $mimc;
2794 }
2795  
2796 #-> sub CPAN::Distribution::is_locally_optional
2797 0 ▶sub is_locally_optional {
Subroutine is_locally_optional: not called CC=9 SCAR=45.0
Pod undocumented
2798 0 my($self, $prereq_pm, $prereq) = @_;
2799 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
2800 0 my($nmo,$opt);
2801 0 for my $rt (qw(requires build_requires)) {
2802 0 ▶ if (exists $prereq_pm->{$rt}{$prereq}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $prereq_pm->{$rt}{$prereq}) 0 0 0
2803 # rt 121914
2804 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
2805 0 my $av = $nmo->available_version;
2806 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
2807 }
2808 0 ▶ if (exists $prereq_pm->{"opt_$rt"}{$prereq}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $$prereq_pm{"opt_$rt"}{$prereq}) 0 0 0
2809 0 $opt = 1;
2810 }
2811 }
2812 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
2813 }
2814  
2815 #-> sub CPAN::Distribution::follow_prereqs ;
2816 0 ▶sub follow_prereqs {
Subroutine follow_prereqs: not called CC=18 SCAR=58.3
Pod undocumented
2817 0 my($self) = shift;
2818 0 my($slot) = shift;
2819 0 my(@prereq_tuples) = grep {$_->[0] ne "perl"} @_;
2820 0 ▶ return unless @prereq_tuples;
Branch: 1 branch
BranchTrueFalseTotal
unless @prereq_tuples 0 0 0
2821 0 my(@good_prereq_tuples);
2822 0 for my $p (@prereq_tuples) {
2823 # e.g. $p = ['Devel::PartialDump', 'r', 1]
2824 # promote if possible
2825 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
2826 0 push @good_prereq_tuples, $p;
2827 } elsif ($p->[1] =~ /^(b)$/) {
2828 0 my $reqtype = CPAN::Queue->reqtype_of($p->[0]);
2829 0 ▶ if ($reqtype =~ /^(r|c)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($reqtype =~ /^(r|c)$/) { } 0 0 0
2830 0 push @good_prereq_tuples, [$p->[0], $reqtype, $p->[2]];
2831 } else {
2832 0 push @good_prereq_tuples, $p;
2833 }
2834 } else {
2835 0 die "Panic: in follow_prereqs: reqtype[$p->[1]] seen, should never happen";
2836 }
2837 }
2838 0 my $pretty_id = $self->pretty_id;
2839 0 my %map = (
2840 b => "build_requires",
2841 r => "requires",
2842 c => "commandline",
2843 );
2844 0 my($filler1,$filler2,$filler3,$filler4);
2845 0 my $unsat = "Unsatisfied dependencies detected during";
2846 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
2847 {
2848 0 my $r = int(($w - length($unsat))/2);
2849 0 my $l = $w - length($unsat) - $r;
2850 0 $filler1 = "-"x4 . " "x$l;
2851 0 $filler2 = " "x$r . "-"x4 . "\n";
2852 }
2853 {
2854 0 my $r = int(($w - length($pretty_id))/2);
2855 0 my $l = $w - length($pretty_id) - $r;
2856 0 $filler3 = "-"x4 . " "x$l;
2857 0 $filler4 = " "x$r . "-"x4 . "\n";
2858 }
2859 $CPAN::Frontend->
2860 myprint("$filler1 $unsat $filler2".
2861 "$filler3 $pretty_id $filler4".
2862 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
2863 );
2864 0 my $follow = 0;
2865 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
2866 0 $follow = 1;
2867 } elsif ($CPAN::Config->{prerequisites_policy} eq "ask") {
2868 0 my $answer = CPAN::Shell::colorable_makemaker_prompt(
2869 "Shall I follow them and prepend them to the queue
2870 of modules we are processing right now?", "yes");
2871 0 $follow = $answer =~ /^\s*y/i;
2872 } else {
2873 0 my @prereq = map { $_->[0] } @good_prereq_tuples;
2874 0 local($") = ", ";
2875 0 $CPAN::Frontend->
2876 myprint(" Ignoring dependencies on modules @prereq\n");
2877 }
2878 0 ▶ if ($follow) {
Branch: 1 branch
BranchTrueFalseTotal
if ($follow) 0 0 0
2879 0 my $id = $self->id;
2880 0 my(@to_queue_mand,@to_queue_opt);
2881 0 for my $gp (@good_prereq_tuples) {
2882 0 my($prereq,$reqtype,$optional) = @$gp;
2883 0 my $qthing = +{qmod=>$prereq,reqtype=>$reqtype,optional=>$optional};
2884 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
2885 $self->is_locally_optional(undef,$prereq)
2886 ){
2887 # Since we do not depend on this one, we do not need
2888 # this in a mandatory arrangement:
2889 0 push @to_queue_opt, $qthing;
2890 } else {
2891 0 my $any = CPAN::Shell->expandany($prereq);
2892 0 $self->{$slot . "_for"}{$any->id}++;
2893 0 ▶ if ($any) {
Branch: 1 branch
BranchTrueFalseTotal
if ($any) { } 0 0 0
2894 0 ▶ unless ($optional) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($optional) 0 0 0
2895 # No recursion check in an optional area of the tree
2896 0 $any->color_cmd_tmps(0,2);
2897 }
2898 } else {
2899 0 $CPAN::Frontend->mywarn("Warning (maybe a bug): Cannot expand prereq '$prereq'\n");
2900 0 $CPAN::Frontend->mysleep(2);
2901 }
2902 # order everything that is not locally_optional just
2903 # like mandatory items: this keeps leaves before
2904 # branches
2905 0 unshift @to_queue_mand, $qthing;
2906 }
2907 }
2908 0 ▶ if (@to_queue_mand) {
Branch: 2 branches
BranchTrueFalseTotal
if (@to_queue_mand) { } 0 0 0
elsif (@to_queue_opt) { } 0 0 0
2909 0 unshift @to_queue_mand, {qmod => $id, reqtype => $self->{reqtype}, optional=> !$self->{mandatory}};
2910 0 CPAN::Queue->jumpqueue(@to_queue_opt,@to_queue_mand);
2911 0 $self->{$slot} = "Delayed until after prerequisites";
2912 0 return 1; # signal we need dependencies
2913 } elsif (@to_queue_opt) {
2914 0 CPAN::Queue->jumpqueue(@to_queue_opt);
2915 }
2916 }
2917 0 return;
2918 }
2919  
2920 11 ▶sub _feature_depends {
Subroutine _feature_depends: called CC=12 SCAR=47.6
2921 11 my($self) = @_;
2922 11 my $meta_yml = $self->parse_meta_yml();
2923 11 ▶ my $optf = $meta_yml->{optional_features} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $optf = $meta_yml->{"optional_features"} or return 0 11 11
2924 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
2925 0 $CPAN::Frontend->mywarn("The content of optional_features is not a HASH reference. Cannot use it.\n");
2926 0 $optf = {};
2927 }
2928 0 ▶ my $wantf = $self->prefs->{features} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $wantf = $self->prefs->{"features"} or return 0 0 0
2929 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
2930 0 $CPAN::Frontend->mywarn("The content of 'features' is not an ARRAY reference. Cannot use it.\n");
2931 0 $wantf = [];
2932 }
2933 0 my $dep = +{};
2934 0 for my $wf (@$wantf) {
2935 0 ▶ if (my $f = $optf->{$wf}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $f = $optf->{$wf}) { } 0 0 0
2936 $CPAN::Frontend->myprint("Found the demanded feature '$wf' that ".
2937 "is accompanied by this description:\n".
2938 $f->{description}.
2939 0 "\n\n"
2940 );
2941 # configure_requires currently not in the spec, unlikely to be useful anyway
2942 0 for my $reqtype (qw(configure_requires build_requires requires)) {
2943 0 ▶ my $reqhash = $f->{$reqtype} or next;
Branch: 1 branch
BranchTrueFalseTotal
my $reqhash = $f->{$reqtype} or next 0 0 0
2944 0 ▶ while (my($k,$v) = each %$reqhash) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$reqhash) 0 0 0
2945 0 $dep->{$reqtype}{$k} = $v;
2946 }
2947 }
2948 } else {
2949 0 $CPAN::Frontend->mywarn("The demanded feature '$wf' was not ".
2950 "found in the META.yml file".
2951 "\n\n"
2952 );
2953 }
2954 }
2955 0 $dep;
2956 }
2957  
2958 14 ▶sub looks_like_static_candidate {
Subroutine looks_like_static_candidate: called CC=6 SCAR=23.0
Pod undocumented
2959 14 my($self) = @_;
2960 14 my $llsc = $self->{_looks_like_static_candidate};
2961 14 ▶ return $llsc if defined $llsc;
Branch: 1 branch
BranchTrueFalseTotal
if defined $llsc 7 7 14
2962 7 my $meta_obj = eval { $self->read_meta };
2963 7 ▶ if (defined $meta_obj) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $meta_obj) { } 0 7 7
elsif (not $meta_obj) { } 7 0 7
2964 0 ▶ if ($meta_obj->dynamic_config) {
Branch: 2 branches
BranchTrueFalseTotal
if ($meta_obj->dynamic_config) { } 0 0 0
elsif ($meta_obj->custom('x_static_install')) { } 0 0 0
2965 0 $llsc = 0;
2966 } elsif ($meta_obj->custom('x_static_install')) {
2967 0 $llsc = 1;
2968 } else {
2969 0 $llsc = 0;
2970 }
2971 } elsif (! $meta_obj) {
2972 7 $llsc = 0;
2973 } else {
2974 0 $CPAN::Frontend->mywarn(sprintf "%s: read_meta did not return a true value\n", $self->pretty_id);
2975 0 $llsc = 0;
2976 }
2977 7 $self->{_looks_like_static_candidate} = $llsc;
2978 7 return $llsc;
2979 }
2980  
2981 11 ▶sub prereqs_for_slot {
Subroutine prereqs_for_slot: called CC=29 SCAR=52.9
Pod undocumented
2982 11 my($self,$slot) = @_;
2983 11 my($prereq_pm);
2984 11 ▶ unless ($CPAN::META->has_usable("CPAN::Meta::Requirements")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_usable("CPAN::Meta::Requirements")) 0 11 11
2985 0 my $whynot = "not available";
2986 0 ▶ if (defined $CPAN::Meta::Requirements::VERSION) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $CPAN::Meta::Requirements::VERSION) 0 0 0
2987 0 $whynot = "version $CPAN::Meta::Requirements::VERSION not sufficient";
2988 }
2989 0 $CPAN::Frontend->mywarn("CPAN::Meta::Requirements $whynot\n");
2990 0 my $before = "";
2991 0 ▶ if ($self->{CALLED_FOR}){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"CALLED_FOR"}) 0 0 0
2992 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
2993 /^(
2994 CPAN::Meta::Requirements
2995 |CPAN::DistnameInfo
2996 |version
2997 |parent
2998 |ExtUtils::MakeMaker
2999 |Test::Harness
3000 )$/x) {
3001 0 $CPAN::Frontend->mywarn("Please install CPAN::Meta::Requirements ".
3002 "as soon as possible; it is needed for a reliable operation of ".
3003 "the cpan shell; setting requirements to nil for '$1' for now ".
3004 "to prevent deadlock during bootstrapping\n");
3005 0 return;
3006 }
3007 0 $before = " before $self->{CALLED_FOR}";
3008 }
3009 0 $CPAN::Frontend->mydie("Please install CPAN::Meta::Requirements manually$before");
3010 }
3011 11 my $merged = CPAN::Meta::Requirements->new;
3012 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
3013 11 my $feature_depends = $self->_feature_depends();
3014 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
3015 7 my $use_static_install = CPAN::HandleConfig->prefs_lookup($self,q{use_static_install});
3016 7 ▶ if (! $CPAN::META->has_inst("CPAN::Static::Install") && (!defined $use_static_install or $use_static_install) && $self->looks_like_static_candidate) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $CPAN::META->has_inst("CPAN::Static::Install") and !defined($use_static_install) || $use_static_install and $self->looks_like_static_candidate) 0 7 7
Condition33%3/9
not $CPAN::META->has_inst("CPAN::Static::Install") and !defined($use_static_install) || $use_static_install and $self->looks_like_static_candidate
!ll&&!rl&&r
070
not $CPAN::META->has_inst("CPAN::Static::Install") and !defined($use_static_install) || $use_static_install
!ll&&!rl&&r
007
not defined $use_static_install or $use_static_install
l!l&&r!l&&!r
700
MC/DC0%0/4
not $CPAN::META->has_inst("CPAN::Static::Install") and !defined($use_static_install) || $use_static_install and $self->looks_like_static_candidate
not $CPAN::META->has_inst("CPAN::Static::Install") not defined $use_static_install $use_static_install $self->looks_like_static_candidate
Truth table16%1/6
not(A) and not(B) or C and D
A= not $CPAN::META->has_inst("CPAN::Static::Install")B= not defined $use_static_installC= $use_static_installD= $self->looks_like_static_candidate
ABCDresult
0XXX0
100X0
11X00
10100
11X11
10111
3017 0 ▶ if ($self->{CALLED_FOR}){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"CALLED_FOR"}) 0 0 0
3018 0 ▶ if ($self->{CALLED_FOR} =~
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"CALLED_FOR"} =~ /^( CPAN::Static::Install )$/x) 0 0 0
3019 /^(
3020 CPAN::Static::Install
3021 )$/x) {
3022 0 $CPAN::Frontend->mywarn("Please install CPAN::Static::Install ".
3023 "as soon as possible; it smoothes out static installations within ".
3024 "the cpan shell\n");
3025 0 return;
3026 }
3027 }
3028 0 my $whynot = "is not installed";
3029 0 $CPAN::Frontend->mywarn("CPAN::Static::Install $whynot\n");
3030 0 $merged->add_minimum( "CPAN::Static::Install" => '0.001' );
3031 }
3032 7 for my $hash ( $self->configure_requires,
3033 $prefs_depends->{configure_requires},
3034 $feature_depends->{configure_requires},
3035 ) {
3036 14 $merged->add_requirements(
3037 CPAN::Meta::Requirements->from_string_hash($hash)
3038 );
3039 }
3040 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
3041 && ! -f File::Spec->catfile($self->{build_dir},"Makefile.PL")
3042 0 && ! @{[ $merged->required_modules ]}
3043 && ! $CPAN::META->has_inst("Module::Build")
3044 ) {
3045 0 $CPAN::Frontend->mywarn(
3046 " Warning: CPAN.pm discovered Module::Build as undeclared prerequisite.\n".
3047 " Adding it now as such.\n"
3048 );
3049 0 $CPAN::Frontend->mysleep(5);
3050 0 $merged->add_minimum( "Module::Build" => 0 );
3051 0 delete $self->{writemakefile};
3052 }
3053 7 $prereq_pm = {}; # configure_requires defined as "b"
3054 } elsif ($slot eq "later") {
3055 4 ▶ unless ($CPAN::META->has_inst("CPAN::Static::Install")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_inst("CPAN::Static::Install")) 4 0 4
3056 4 ▶ if ($self->{CALLED_FOR}){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"CALLED_FOR"}) 4 0 4
3057 4 ▶ if ($self->{CALLED_FOR} =~
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"CALLED_FOR"} =~ /^( CPAN::Static::Install )$/x) 0 4 4
3058 /^(
3059 CPAN::Static::Install
3060 )$/x) {
3061 0 $CPAN::Frontend->mywarn("Trying to load uninstalled CPAN::Static::Install now\n");
3062 0 local @INC = @INC;
3063 0 push @INC, File::Spec->catdir($self->{build_dir},"lib");
3064 0 require CPAN::Static::Install;
3065 0 $CPAN::Frontend->mywarn("CPAN::Static::Install loaded\n");
3066 0 $self->{static_install} = 1;
3067 }
3068 }
3069 }
3070 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
3071 4 for my $reqtype (qw(requires build_requires opt_requires opt_build_requires)) {
3072 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
3073 16 for my $dep ($prefs_depends,$feature_depends) {
3074 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
3075 0 $prereq_pm->{$reqtype}{$k} = $dep->{$reqtype}{$k};
3076 }
3077 }
3078 }
3079 # XXX what about optional_req|breq? -- xdg, 2012-04-01
3080 4 for my $hash (
3081 $prereq_pm->{requires},
3082 $prereq_pm->{build_requires},
3083 $prereq_pm->{opt_requires},
3084 $prereq_pm->{opt_build_requires},
3085  
3086 ) {
3087 16 $merged->add_requirements(
3088 CPAN::Meta::Requirements->from_string_hash($hash)
3089 );
3090 }
3091 } else {
3092 0 die "Panic: illegal slot '$slot'";
3093 }
3094 11 return ($merged->as_string_hash, $prereq_pm);
3095 }
3096  
3097 #-> sub CPAN::Distribution::unsat_prereq ;
3098 # return ([Foo,"r"],[Bar,"b"]) for normal modules
3099 # return ([perl=>5.008]) if we need a newer perl than we are running under
3100 # (sorry for the inconsistency, it was an accident)
3101 11 ▶sub unsat_prereq {
Subroutine unsat_prereq: called CC=54 SCAR=74.7
Pod undocumented
3102 11 my($self,$slot) = @_;
3103 11 my($merged_hash,$prereq_pm) = $self->prereqs_for_slot($slot);
3104 11 my(@need);
3105 11 ▶ unless ($CPAN::META->has_usable("CPAN::Meta::Requirements")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_usable("CPAN::Meta::Requirements")) 0 11 11
3106 0 $CPAN::Frontend->mywarn("CPAN::Meta::Requirements not available, please install as soon as possible, trying to continue with severly limited capabilities\n");
3107 0 return;
3108 }
3109 11 my $merged = CPAN::Meta::Requirements->from_string_hash($merged_hash);
3110 11 my @merged = sort $merged->required_modules;
3111 11 ▶ CPAN->debug("all merged_prereqs[@merged]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 11 11
3112 11 NEED: for my $need_module ( @merged ) {
3113 8 my $need_version = $merged->requirements_for_module($need_module);
3114 8 my($available_version,$inst_file,$available_file,$nmo);
3115 8 ▶ if ($need_module eq "perl") {
Branch: 1 branch
BranchTrueFalseTotal
if ($need_module eq 'perl') { } 0 8 8
3116 0 $available_version = $];
3117 0 $available_file = CPAN::find_perl();
3118 } else {
3119 8 ▶ if (CPAN::_sqlite_running()) {
Branch: 1 branch
BranchTrueFalseTotal
if (CPAN::_sqlite_running()) 0 8 8
3120 0 CPAN::Index->reload;
3121 0 $CPAN::SQLite->search("CPAN::Module",$need_module);
3122 }
3123 8 $nmo = $CPAN::META->instance("CPAN::Module",$need_module);
3124 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
3125 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
3126 8 $available_version = $nmo->available_version;
3127 8 ▶ if ($nmo->uptodate) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nmo->uptodate) 8 0 8
3128 8 my $accepts = eval {
3129 8 $merged->accepts_module($need_module, $available_version);
3130 };
3131 8 ▶ unless ($accepts) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($accepts) 0 8 8
3132 0 my $rq = $merged->requirements_for_module( $need_module );
3133 0 $CPAN::Frontend->mywarn(
3134 "Warning: Version '$available_version' of ".
3135 "'$need_module' is up to date but does not ".
3136 "fulfill requirements ($rq). I will continue, ".
3137 "but chances to succeed are low.\n");
3138 }
3139 8 next NEED;
3140 }
3141  
3142 # if they have not specified a version, we accept any
3143 # installed one; in that case inst_file is always
3144 # sufficient and available_file is sufficient on
3145 # both build_requires and configure_requires
3146 my $sufficient = $inst_file ||
3147 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
3148 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
3149 and ( # a few quick short circuits
3150 not defined $need_version
3151 or $need_version eq '0' # "==" would trigger warning when not numeric
3152 or $need_version eq "undef"
3153 )) {
3154 0 ▶ unless ($nmo->inst_deprecated) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($nmo->inst_deprecated) 0 0 0
3155 0 next NEED;
3156 }
3157 }
3158 }
3159  
3160 # We only want to install prereqs if either they're not installed
3161 # or if the installed version is too old. We cannot omit this
3162 # check, because if 'force' is in effect, nobody else will check.
3163 # But we don't want to accept a deprecated module installed as part
3164 # of the Perl core, so we continue if the available file is the installed
3165 # one and is deprecated
3166  
3167 0 ▶ if ( $available_file ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($available_file) 0 0 0
3168 0 my $fulfills_all_version_rqs = $self->_fulfills_all_version_rqs
3169 (
3170 $need_module,
3171 $available_file,
3172 $available_version,
3173 $need_version,
3174 );
3175 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
3176 && $available_file eq $inst_file
3177 && $nmo->inst_deprecated
3178 ) {
3179 # continue installing as a prereq. we really want that
3180 # because the deprecated module may spit out warnings
3181 # and third party did not know until today. Only one
3182 # exception is OK, because CPANPLUS is special after
3183 # all:
3184 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
3185 $nmo->id =~ /^CPANPLUS(?:::Dist::Build)$/
3186 ) {
3187 # here we have an available version that is good
3188 # enough although deprecated (preventing circular
3189 # loop CPANPLUS => CPANPLUS::Dist::Build RT#83042)
3190 0 next NEED;
3191 }
3192 ▶ } 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
3193 $self->{reqtype} # e.g. maybe we came via goto?
3194 && $self->{reqtype} =~ /^(r|c)$/
3195 && ( exists $prereq_pm->{requires}{$need_module}
3196 || exists $prereq_pm->{opt_requires}{$need_module} )
3197 && $nmo
3198 && !$inst_file
3199 ) {
3200 # continue installing as a prereq; this may be a
3201 # distro we already used when it was a build_requires
3202 # so we did not install it. But suddenly somebody
3203 # wants it as a requires
3204 0 my $need_distro = $nmo->distribution;
3205 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
3206 0 my $id = $need_distro->pretty_id;
3207 0 $CPAN::Frontend->myprint("Promoting $id from build_requires to requires due $need_module\n");
3208 0 delete $need_distro->{install}; # promote to another installation attempt
3209 0 $need_distro->{reqtype} = "r";
3210 0 $need_distro->install;
3211 0 next NEED;
3212 }
3213 }
3214 else {
3215 0 ▶ next NEED if $fulfills_all_version_rqs;
Branch: 1 branch
BranchTrueFalseTotal
if $fulfills_all_version_rqs 0 0 0
3216 }
3217 }
3218  
3219 0 ▶ if ($need_module eq "perl") {
Branch: 1 branch
BranchTrueFalseTotal
if ($need_module eq "perl") 0 0 0
3220 0 return ["perl", $need_version];
3221 }
3222 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
3223 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
3224 0 ▶ if (my $sponsoring = $self->{sponsored_mods}{$need_module}++) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $sponsoring = $self->{"sponsored_mods"}{$need_module}++) 0 0 0
3225 # We have already sponsored it and for some reason it's still
3226 # not available. So we do ... what??
3227  
3228 # if we push it again, we have a potential infinite loop
3229  
3230 # The following "next" was a very problematic construct.
3231 # It helped a lot but broke some day and had to be
3232 # replaced.
3233  
3234 # We must be able to deal with modules that come again and
3235 # again as a prereq and have themselves prereqs and the
3236 # queue becomes long but finally we would find the correct
3237 # order. The RecursiveDependency check should trigger a
3238 # die when it's becoming too weird. Unfortunately removing
3239 # this next breaks many other things.
3240  
3241 # The bug that brought this up is described in Todo under
3242 # "5.8.9 cannot install Compress::Zlib"
3243  
3244 # next; # this is the next that had to go away
3245  
3246 # The following "next NEED" are fine and the error message
3247 # explains well what is going on. For example when the DBI
3248 # fails and consequently DBD::SQLite fails and now we are
3249 # processing CPAN::SQLite. Then we must have a "next" for
3250 # DBD::SQLite. How can we get it and how can we identify
3251 # all other cases we must identify?
3252  
3253 0 my $do = $nmo->distribution;
3254 0 ▶ next NEED unless $do; # not on CPAN
Branch: 1 branch
BranchTrueFalseTotal
unless $do 0 0 0
3255 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
3256 0 $CPAN::Frontend->mywarn("Warning: Prerequisite ".
3257 "'$need_module => $need_version' ".
3258 "for '$self->{ID}' seems ".
3259 "not available according to the indices\n"
3260 );
3261 0 next NEED;
3262 }
3263 0 NOSAYER: for my $nosayer (
3264 "unwrapped",
3265 "writemakefile",
3266 "signature_verify",
3267 "make",
3268 "make_test",
3269 "install",
3270 "make_clean",
3271 ) {
3272 0 ▶ if ($do->{$nosayer}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($do->{$nosayer}) 0 0 0
3273 0 my $selfid = $self->pretty_id;
3274 0 my $did = $do->pretty_id;
3275 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
3276 $do->{$nosayer}->failed :
3277 $do->{$nosayer} =~ /^NO/) {
3278 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
3279 &&
3280 $do->{make_test}{COMMANDID} != $CPAN::CurrentCommandId
3281 ) {
3282 0 next NOSAYER;
3283 }
3284 ### XXX don't complain about missing optional deps -- xdg, 2012-04-01
3285 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
3286 # don't complain about failing optional prereqs
3287 }
3288 else {
3289 0 $CPAN::Frontend->mywarn("Warning: Prerequisite ".
3290 "'$need_module => $need_version' ".
3291 "for '$selfid' failed when ".
3292 "processing '$did' with ".
3293 "'$nosayer => $do->{$nosayer}'. Continuing, ".
3294 "but chances to succeed are limited.\n"
3295 );
3296 0 $CPAN::Frontend->mysleep($sponsoring/10);
3297 }
3298 0 next NEED;
3299 } else { # the other guy succeeded
3300 0 ▶ if ($nosayer =~ /^(install|make_test)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nosayer =~ /^(install|make_test)$/) 0 0 0
3301 # we had this with
3302 # DMAKI/DateTime-Calendar-Chinese-0.05.tar.gz
3303 # in 2007-03 for 'make install'
3304 # and 2008-04: #30464 (for 'make test')
3305 # $CPAN::Frontend->mywarn("Warning: Prerequisite ".
3306 # "'$need_module => $need_version' ".
3307 # "for '$selfid' already built ".
3308 # "but the result looks suspicious. ".
3309 # "Skipping another build attempt, ".
3310 # "to prevent looping endlessly.\n"
3311 # );
3312 0 next NEED;
3313 }
3314 }
3315 }
3316 }
3317 }
3318 0 my $needed_as;
3319 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
3320 ▶ } 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
3321 || exists $prereq_pm->{opt_requires}{$need_module}
3322 ) {
3323 0 $needed_as = "r";
3324 } elsif ($slot eq "configure_requires_later") {
3325 # in ae872487d5 we said: C< we have not yet run the
3326 # {Build,Makefile}.PL, we must presume "r" >; but the
3327 # meta.yml standard says C< These dependencies are not
3328 # required after the distribution is installed. >; so now
3329 # we change it back to "b" and care for the proper
3330 # promotion later.
3331 0 $needed_as = "b";
3332 } else {
3333 0 $needed_as = "b";
3334 }
3335 # here need to flag as optional for recommends/suggests
3336 # -- xdg, 2012-04-01
3337 $self->debug(sprintf "%s mandatory?[%s]",
3338 $self->pretty_id,
3339 0 ▶ defined($self->{mandatory}) ? $self->{mandatory} : "<undef>")
Branch: 2 branches
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
defined $self->{'mandatory'} ? : 0 0 0
3340 if $CPAN::DEBUG;
3341 my $optional = !$self->{mandatory}
3342 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
3343 0 push @need, [$need_module,$needed_as,$optional];
3344 }
3345 0 my @unfolded = map { "[".join(",",@$_)."]" } @need;
3346 11 ▶ CPAN->debug("returning from unsat_prereq[@unfolded]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 11 11
3347 11 @need;
3348 }
3349  
3350 0 ▶sub _fulfills_all_version_rqs {
Subroutine _fulfills_all_version_rqs: not called CC=13 SCAR=52.0
3351 0 my($self,$need_module,$available_file,$available_version,$need_version) = @_;
3352 0 my(@all_requirements) = split /\s*,\s*/, $need_version;
3353 0 local($^W) = 0;
3354 0 my $ok = 0;
3355 0 RQ: for my $rq (@all_requirements) {
3356 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
3357 } elsif ($rq =~ s|>\s*||) {
3358 # 2005-12: one user
3359 0 ▶ if (CPAN::Version->vgt($available_version,$rq)) {
Branch: 1 branch
BranchTrueFalseTotal
if ("CPAN::Version"->vgt($available_version, $rq)) 0 0 0
3360 0 $ok++;
3361 }
3362 0 next RQ;
3363 } elsif ($rq =~ s|!=\s*||) {
3364 # 2005-12: no user
3365 0 ▶ if (CPAN::Version->vcmp($available_version,$rq)) {
Branch: 1 branch
BranchTrueFalseTotal
if ('CPAN::Version'->vcmp($available_version, $rq)) { } 0 0 0
3366 0 $ok++;
3367 0 next RQ;
3368 } else {
3369 0 $ok=0;
3370 0 last RQ;
3371 }
3372 } elsif ($rq =~ m|<=?\s*|) {
3373 # 2005-12: no user
3374 0 $CPAN::Frontend->mywarn("Downgrading not supported (rq[$rq])\n");
3375 0 $ok++;
3376 0 next RQ;
3377 } elsif ($rq =~ s|==\s*||) {
3378 # 2009-07: ELLIOTJS/Perl-Critic-1.099_002.tar.gz
3379 0 ▶ if (CPAN::Version->vcmp($available_version,$rq)) {
Branch: 1 branch
BranchTrueFalseTotal
if ('CPAN::Version'->vcmp($available_version, $rq)) { } 0 0 0
3380 0 $ok=0;
3381 0 last RQ;
3382 } else {
3383 0 $ok++;
3384 0 next RQ;
3385 }
3386 }
3387 0 ▶ if (! CPAN::Version->vgt($rq, $available_version)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("CPAN::Version"->vgt($rq, $available_version)) 0 0 0
3388 0 $ok++;
3389 }
3390 0 ▶ CPAN->debug(sprintf("need_module[%s]available_file[%s]".
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3391 "available_version[%s]rq[%s]ok[%d]",
3392 $need_module,
3393 $available_file,
3394 $available_version,
3395 CPAN::Version->readable($rq),
3396 $ok,
3397 )) if $CPAN::DEBUG;
3398 }
3399 0 my $ret = $ok == @all_requirements;
3400 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
3401 0 return $ret;
3402 }
3403  
3404 #-> sub CPAN::Distribution::read_meta
3405 # read any sort of meta files, return CPAN::Meta object if no errors
3406 43 ▶sub read_meta {
Subroutine read_meta: called CC=7 SCAR=24.6
Pod undocumented
3407 43 my($self) = @_;
3408 43 ▶ my $meta_file = $self->pick_meta_file
Branch: 1 branch
BranchTrueFalseTotal
my $meta_file = $self->pick_meta_file or return 34 9 43
3409 or return;
3410  
3411 34 ▶ return unless $CPAN::META->has_usable("CPAN::Meta");
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::META->has_usable("CPAN::Meta") 0 34 34
3412 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
3413 or return;
3414  
3415 # Very old EU::MM could have wrong META
3416 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
3417 && $meta->generated_by =~ /ExtUtils::MakeMaker version ([\d\._]+)/
3418 ) {
3419 0 my $eummv = do { local $^W = 0; $1+0; };
3420 0 ▶ return if $eummv < 6.2501;
Branch: 1 branch
BranchTrueFalseTotal
if $eummv < "6.2501" 0 0 0
3421 }
3422  
3423 34 return $meta;
3424 }
3425  
3426 #-> sub CPAN::Distribution::read_yaml ;
3427 # XXX This should be DEPRECATED -- dagolden, 2011-02-05
3428 8 ▶sub read_yaml {
Subroutine read_yaml: called CC=15 SCAR=32.6
Pod undocumented
3429 8 my($self) = @_;
3430 8 my $meta_file = $self->pick_meta_file('\.yml$');
3431 8 ▶ $self->debug("meta_file[$meta_file]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 8 8
3432 8 ▶ return unless $meta_file;
Branch: 1 branch
BranchTrueFalseTotal
unless $meta_file 2 6 8
3433 6 my $yaml;
3434 6 eval { $yaml = $self->parse_meta_yml($meta_file) };
3435 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
3436 0 return undef; # if we die, then we cannot read YAML's own META.yml
3437 }
3438 # not "authoritative"
3439 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
3440 0 $CPAN::Frontend->mywarn("META.yml does not seem to be conforming, cannot use it.\n");
3441 0 $yaml = undef;
3442 }
3443 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
3444 if $CPAN::DEBUG;
3445 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
3446 # MYMETA.yml is static and authoritative by definition
3447 6 ▶ if ( $meta_file =~ /MYMETA\.yml/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($meta_file =~ /MYMETA\.yml/) 2 4 6
3448 2 return $yaml;
3449 }
3450 # META.yml is authoritative only if dynamic_config is defined and false
3451 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
3452 2 return $yaml;
3453 }
3454 # otherwise, we can't use what we found
3455 2 return undef;
3456 }
3457  
3458 #-> sub CPAN::Distribution::configure_requires ;
3459 7 ▶sub configure_requires {
Subroutine configure_requires: called CC=4 SCAR=25.0
Pod undocumented
3460 7 my($self) = @_;
3461 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
3462 0 ▶ if (my $meta_obj = $self->read_meta) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $meta_obj = $self->read_meta) { } 0 0 0
3463 0 my $prereqs = $meta_obj->effective_prereqs;
3464 0 my $cr = $prereqs->requirements_for(qw/configure requires/);
3465 0 ▶ return $cr ? $cr->as_string_hash : undef;
Branch: 1 branch
BranchTrueFalseTotal
$cr ? : 0 0 0
3466 }
3467 else {
3468 0 my $yaml = eval { $self->parse_meta_yml($meta_file) };
3469 0 return $yaml->{configure_requires};
3470 }
3471 }
3472  
3473 #-> sub CPAN::Distribution::prereq_pm ;
3474 24 ▶sub prereq_pm {
Subroutine prereq_pm: called CC=67 SCAR=75.8
Pod undocumented
3475 24 my($self) = @_;
3476 24 my $use_static_install = $CPAN::Config->{use_static_install};
3477 return unless $self->{writemakefile} # no need to have succeeded
3478 # but we must have run it
3479 || $self->{modulebuild}
3480 24 ▶ || $use_static_install
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"writemakefile"} or $self->{"modulebuild"} or $use_static_install or not defined $use_static_install 0 24 24
Condition66%6/9
$self->{"writemakefile"} or $self->{"modulebuild"} or $use_static_install or not defined $use_static_install
l!l&&r!l&&!r
1770
$self->{"writemakefile"} or $self->{"modulebuild"} or $use_static_install
l!l&&r!l&&!r
1707
$self->{"writemakefile"} or $self->{"modulebuild"}
l!l&&r!l&&!r
1707
MC/DC0%0/4
$self->{"writemakefile"} or $self->{"modulebuild"} or $use_static_install or not defined $use_static_install
$self->{"writemakefile"} $self->{"modulebuild"} $use_static_install not defined $use_static_install
Truth table40%2/5
A or B or C or not(D)
A= $self->{"writemakefile"}B= $self->{"modulebuild"}C= $use_static_installD= not defined $use_static_install
ABCDresult
1XXX1
01XX1
001X1
00011
00000
3481 || ! defined $use_static_install
3482 ;
3483 24 ▶ unless ($self->{build_dir}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"build_dir"}) 7 17 24
3484 7 return;
3485 }
3486 17 ▶ if ($self->{cleanup_after_install_done}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"cleanup_after_install_done"}) 0 17 17
3487 0 return;
3488 }
3489 # no Makefile/Build means configuration aborted, so don't look for prereqs
3490 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
3491 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
3492 17 ▶ return unless -f $makefile || -f $buildfile || $self->{static_install};
Branch: 1 branch
BranchTrueFalseTotal
unless -f $makefile or -f $buildfile or $self->{"static_install"} 3 14 17
Condition66%4/6
-f $makefile or -f $buildfile or $self->{"static_install"}
l!l&&r!l&&!r
1403
-f $makefile or -f $buildfile
l!l&&r!l&&!r
1403
MC/DC33%1/3
-f $makefile or -f $buildfile or $self->{"static_install"}
-f $makefile -f $buildfile $self->{"static_install"}
Truth table50%2/4
A or B or C
A= -f $makefileB= -f $buildfileC= $self->{"static_install"}
ABCresult
1XX1
01X1
0011
0000
3493 CPAN->debug(sprintf "writemakefile[%s]modulebuild[%s]",
3494 $self->{writemakefile}||"",
3495 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
3496 ) if $CPAN::DEBUG;
3497 14 my($req,$breq, $opt_req, $opt_breq);
3498 14 my $meta_obj = $self->read_meta;
3499 # META/MYMETA is only authoritative if dynamic_config is false
3500 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
3501 14 my $prereqs = $meta_obj->effective_prereqs;
3502 14 my $requires = $prereqs->requirements_for(qw/runtime requires/);
3503 14 my $build_requires = $prereqs->requirements_for(qw/build requires/);
3504 14 my $test_requires = $prereqs->requirements_for(qw/test requires/);
3505 # XXX we don't yet distinguish build vs test, so merge them for now
3506 14 $build_requires->add_requirements($test_requires);
3507 14 $req = $requires->as_string_hash;
3508 14 $breq = $build_requires->as_string_hash;
3509  
3510 # XXX assemble optional_req && optional_breq from recommends/suggests
3511 # depending on corresponding policies -- xdg, 2012-04-01
3512 14 CPAN->use_inst("CPAN::Meta::Requirements");
3513 14 my $opt_runtime = CPAN::Meta::Requirements->new;
3514 14 my $opt_build = CPAN::Meta::Requirements->new;
3515 14 ▶ if ( $CPAN::Config->{recommends_policy} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"recommends_policy"}) 0 14 14
3516 0 $opt_runtime->add_requirements( $prereqs->requirements_for(qw/runtime recommends/));
3517 0 $opt_build->add_requirements( $prereqs->requirements_for(qw/build recommends/));
3518 0 $opt_build->add_requirements( $prereqs->requirements_for(qw/test recommends/));
3519  
3520 }
3521 14 ▶ if ( $CPAN::Config->{suggests_policy} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"suggests_policy"}) 0 14 14
3522 0 $opt_runtime->add_requirements( $prereqs->requirements_for(qw/runtime suggests/));
3523 0 $opt_build->add_requirements( $prereqs->requirements_for(qw/build suggests/));
3524 0 $opt_build->add_requirements( $prereqs->requirements_for(qw/test suggests/));
3525 }
3526 14 $opt_req = $opt_runtime->as_string_hash;
3527 14 $opt_breq = $opt_build->as_string_hash;
3528 }
3529 elsif (my $yaml = $self->read_yaml) { # often dynamic_config prevents a result here
3530 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
3531 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
3532 0 ▶ if ( $CPAN::Config->{recommends_policy} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Config->{"recommends_policy"}) 0 0 0
3533 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
3534 }
3535 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
3536 0 ▶ if ($req) {
Branch: 1 branch
BranchTrueFalseTotal
if ($req) 0 0 0
3537 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
3538 $yaml->{generated_by} =~ /ExtUtils::MakeMaker version ([\d\._]+)/) {
3539 0 my $eummv = do { local $^W = 0; $1+0; };
3540 0 ▶ if ($eummv < 6.2501) {
Branch: 1 branch
BranchTrueFalseTotal
if ($eummv < "6.2501") 0 0 0
3541 # thanks to Slaven for digging that out: MM before
3542 # that could be wrong because it could reflect a
3543 # previous release
3544 0 undef $req;
3545 }
3546 }
3547 0 my $areq;
3548 my $do_replace;
3549 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
3550 0 my $v = $req->{$k};
3551 0 ▶ next unless defined $v;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $v 0 0 0
3552 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
3553 0 $areq->{$k} = $v;
3554 ▶ } 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
3555 $v =~ /[A-Za-z]/ &&
3556 $CPAN::META->exists("CPAN::Module",$v)
3557 ) {
3558 0 $CPAN::Frontend->mywarn("Suspicious key-value pair in META.yml's ".
3559 "requires hash: $k => $v; I'll take both ".
3560 "key and value as a module name\n");
3561 0 $CPAN::Frontend->mysleep(1);
3562 0 $areq->{$k} = 0;
3563 0 $areq->{$v} = 0;
3564 0 $do_replace++;
3565 }
3566 }
3567 0 ▶ $req = $areq if $do_replace;
Branch: 1 branch
BranchTrueFalseTotal
if $do_replace 0 0 0
3568 }
3569 }
3570 else {
3571 0 $CPAN::Frontend->mywarnonce("Could not read metadata file. Falling back to other ".
3572 "methods to determine prerequisites\n");
3573 }
3574  
3575 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
3576 0 my $build_dir;
3577 0 ▶ unless ( $build_dir = $self->{build_dir} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($build_dir = $self->{"build_dir"}) 0 0 0
3578 0 return;
3579 }
3580 0 my $makefile = File::Spec->catfile($build_dir,"Makefile");
3581 0 my $fh;
3582 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
3583 and
3584 $fh = FileHandle->new("<$makefile\0")) {
3585 0 ▶ CPAN->debug("Getting prereq from Makefile") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3586 0 local($/) = "\n";
3587 0 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
3588 0 ▶ last if /MakeMaker post_initialize section/;
Branch: 1 branch
BranchTrueFalseTotal
if /MakeMaker post_initialize section/ 0 0 0
3589 0 my($p) = m{^[\#]
3590 \s+PREREQ_PM\s+=>\s+(.+)
3591 }x;
3592 0 ▶ next unless $p;
Branch: 1 branch
BranchTrueFalseTotal
unless $p 0 0 0
3593 # warn "Found prereq expr[$p]";
3594  
3595 # Regexp modified by A.Speer to remember actual version of file
3596 # PREREQ_PM hash key wants, then add to
3597 0 ▶ while ( $p =~ m/(?:\s)([\w\:]+)=>(q\[.*?\]|undef),?/g ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($p =~ /(?:\s)([\w\:]+)=>(q\[.*?\]|undef),?/g) 0 0 0
3598 0 my($m,$n) = ($1,$2);
3599 # When a prereq is mentioned twice: let the bigger
3600 # win; usual culprit is that they declared
3601 # build_requires separately from requires; see
3602 # rt.cpan.org #47774
3603 0 my($prevn);
3604 0 ▶ if ( defined $req->{$m} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $req->{$m}) 0 0 0
3605 0 $prevn = $req->{$m};
3606 }
3607 0 ▶ if ($n =~ /^q\[(.*?)\]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n =~ /^q\[(.*?)\]$/) 0 0 0
3608 0 $n = $1;
3609 }
3610 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
3611 0 $req->{$m} = $n;
3612 }
3613 }
3614 0 last;
3615 }
3616 }
3617 }
3618 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
3619 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
3620 0 my $buildfile = File::Spec->catfile($build_dir,"Build");
3621 0 ▶ if (-f $buildfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $buildfile) 0 0 0
3622 0 ▶ CPAN->debug("Found '$buildfile'") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3623 0 my $build_prereqs = File::Spec->catfile($build_dir,"_build","prereqs");
3624 0 ▶ if (-f $build_prereqs) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $build_prereqs) 0 0 0
3625 0 ▶ CPAN->debug("Getting prerequisites from '$build_prereqs'") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3626 0 my $content = do { local *FH;
3627 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
3628 or $CPAN::Frontend->mydie("Could not open ".
3629 "'$build_prereqs': $!");
3630 0 local $/;
3631 0 <FH>;
3632 };
3633 0 my $bphash = eval $content;
3634 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 0 0
3635 } else {
3636 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
3637 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
3638 }
3639 }
3640 }
3641 }
3642 # XXX needs to be adapted for optional_req & optional_breq -- xdg, 2012-04-01
3643 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
3644 return $self->{prereq_pm} = {
3645 14 requires => $req,
3646 build_requires => $breq,
3647 opt_requires => $opt_req,
3648 opt_build_requires => $opt_breq,
3649 };
3650 }
3651 }
3652  
3653 #-> sub CPAN::Distribution::shortcut_test ;
3654 # return values: undef means don't shortcut; 0 means shortcut as fail;
3655 # and 1 means shortcut as success
3656 4 ▶sub shortcut_test {
Subroutine shortcut_test: called CC=16 SCAR=43.7
Pod undocumented
3657 4 my ($self) = @_;
3658  
3659 4 ▶ $self->debug("checking badtestcnt[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 4 4
3660 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
3661 4 ▶ if ($self->{badtestcnt} > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"badtestcnt"} > 0) 0 4 4
3662 0 require Data::Dumper;
3663 0 ▶ CPAN->debug(sprintf "NOREPEAT[%s]", Data::Dumper::Dumper($self)) if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3664 0 return $self->goodbye("Won't repeat unsuccessful test during this command");
3665 }
3666  
3667 4 for my $slot ( qw/later configure_requires_later/ ) {
3668 8 ▶ $self->debug("checking $slot slot[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 8 8
3669 return $self->success($self->{$slot})
3670 8 ▶ if $self->{$slot};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{$slot} 0 8 8
3671 }
3672  
3673 4 ▶ $self->debug("checking if tests passed[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 4 4
3674 4 ▶ if ( $self->{make_test} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"make_test"}) 0 4 4
3675 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
3676 UNIVERSAL::can($self->{make_test},"failed") ?
3677 $self->{make_test}->failed :
3678 $self->{make_test} =~ /^NO/
3679 ) {
3680 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
3681 UNIVERSAL::can($self->{make_test},"commandid")
3682 &&
3683 $self->{make_test}->commandid == $CPAN::CurrentCommandId
3684 ) {
3685 0 return $self->goodbye("Has already been tested within this command");
3686 }
3687 } else {
3688 # if global "is_tested" has been cleared, we need to mark this to
3689 # be added to PERL5LIB if not already installed
3690 0 ▶ if ($self->tested_ok_but_not_installed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->tested_ok_but_not_installed) 0 0 0
3691 0 $CPAN::META->is_tested($self->{build_dir},$self->{make_test}{TIME});
3692 }
3693 0 return $self->success("Has already been tested successfully");
3694 }
3695 }
3696  
3697 4 ▶ if ($self->{notest}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"notest"}) 0 4 4
3698 0 $self->{make_test} = CPAN::Distrostatus->new("YES");
3699 0 return $self->success("Skipping test because of notest pragma");
3700 }
3701  
3702 4 return undef; # no shortcut
3703 }
3704  
3705 #-> sub CPAN::Distribution::_exe_files ;
3706 0 ▶sub _exe_files {
Subroutine _exe_files: not called CC=24 SCAR=64.0
3707 0 my($self) = @_;
3708 return unless $self->{writemakefile} # no need to have succeeded
3709 # but we must have run it
3710 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
3711 0 ▶ unless ($self->{build_dir}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"build_dir"}) 0 0 0
3712 0 return;
3713 }
3714 CPAN->debug(sprintf "writemakefile[%s]modulebuild[%s]",
3715 $self->{writemakefile}||"",
3716 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
3717 ) if $CPAN::DEBUG;
3718 0 my $build_dir;
3719 0 ▶ unless ( $build_dir = $self->{build_dir} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($build_dir = $self->{"build_dir"}) 0 0 0
3720 0 return;
3721 }
3722 0 my $makefile = File::Spec->catfile($build_dir,"Makefile");
3723 0 my $fh;
3724 my @exe_files;
3725 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
3726 and
3727 $fh = FileHandle->new("<$makefile\0")) {
3728 0 ▶ CPAN->debug("Getting exefiles from Makefile") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3729 0 local($/) = "\n";
3730 0 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
3731 0 ▶ last if /MakeMaker post_initialize section/;
Branch: 1 branch
BranchTrueFalseTotal
if /MakeMaker post_initialize section/ 0 0 0
3732 0 my($p) = m{^[\#]
3733 \s+EXE_FILES\s+=>\s+\[(.+)\]
3734 }x;
3735 0 ▶ next unless $p;
Branch: 1 branch
BranchTrueFalseTotal
unless $p 0 0 0
3736 # warn "Found exefiles expr[$p]";
3737 0 my @p = split /,\s*/, $p;
3738 0 for my $p2 (@p) {
3739 0 ▶ if ($p2 =~ /^q\[(.+)\]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($p2 =~ /^q\[(.+)\]/) 0 0 0
3740 0 push @exe_files, $1;
3741 }
3742 }
3743 }
3744 }
3745 0 ▶ return \@exe_files if @exe_files;
Branch: 1 branch
BranchTrueFalseTotal
if @exe_files 0 0 0
3746 0 my $buildparams = File::Spec->catfile($build_dir,"_build","build_params");
3747 0 ▶ if (-f $buildparams) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $buildparams) 0 0 0
3748 0 ▶ CPAN->debug("Found '$buildparams'") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3749 0 my $x = do $buildparams;
3750 0 for my $sf ($x->[2]{script_files}) {
3751 0 ▶ if (my $reftype = ref $sf) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $reftype = ref $sf) { } 0 0 0
elsif (defined $sf) { } 0 0 0
3752 0 ▶ if ($reftype eq "ARRAY") {
Branch: 2 branches
BranchTrueFalseTotal
if ($reftype eq 'ARRAY') { } 0 0 0
elsif ($reftype eq 'HASH') { } 0 0 0
3753 0 push @exe_files, @$sf;
3754 }
3755 elsif ($reftype eq "HASH") {
3756 0 push @exe_files, keys %$sf;
3757 }
3758 else {
3759 0 $CPAN::Frontend->mywarn("Invalid reftype $reftype for Build.PL 'script_files'\n");
3760 }
3761 }
3762 elsif (defined $sf) {
3763 0 push @exe_files, $sf;
3764 }
3765 }
3766 }
3767 0 return \@exe_files;
3768 }
3769  
3770 #-> sub CPAN::Distribution::test ;
3771 7 ▶sub test {
Subroutine test: called CC=66 SCAR=68.5
Pod undocumented
3772 7 my($self) = @_;
3773  
3774 7 $self->pre_test();
3775  
3776 7 ▶ if (exists $self->{cleanup_after_install_done}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"cleanup_after_install_done"}) 0 7 7
3777 0 $self->post_test();
3778 0 return $self->make;
3779 }
3780  
3781 7 ▶ $self->debug("checking goto id[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
3782 7 ▶ if (my $goto = $self->prefs->{goto}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $goto = $self->prefs->{"goto"}) 0 7 7
3783 0 $self->post_test();
3784 0 return $self->goto($goto);
3785 }
3786  
3787 7 ▶ unless ($self->make){
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->make) 3 4 7
3788 3 $self->post_test();
3789 3 return;
3790 }
3791  
3792 4 ▶ if ( defined( my $sc = $self->shortcut_test ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $sc = $self->shortcut_test)) 0 4 4
3793 0 $self->post_test();
3794 0 return $sc;
3795 }
3796  
3797 4 ▶ if ($CPAN::Signal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Signal) 0 4 4
3798 0 delete $self->{force_update};
3799 0 $self->post_test();
3800 0 return;
3801 }
3802 # warn "XDEBUG: checking for notest: $self->{notest} $self";
3803 4 ▶ my $make = $self->{modulebuild} ? "Build" : "make";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'modulebuild'} ? : 0 4 4
3804  
3805 local $ENV{PERL5LIB} = defined($ENV{PERL5LIB})
3806 ? $ENV{PERL5LIB}
3807 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
3808  
3809 4 ▶ local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : "";
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL5OPT'} ? : 4 0 4
3810 local $ENV{PERL_USE_UNSAFE_INC} =
3811 exists $ENV{PERL_USE_UNSAFE_INC} && defined $ENV{PERL_USE_UNSAFE_INC}
3812 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
3813 4 $CPAN::META->set_perl5lib;
3814 4 local $ENV{MAKEFLAGS}; # protect us from outer make calls
3815 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
3816 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
3817  
3818 4 ▶ if ($run_allow_installing_within_test) {
Branch: 1 branch
BranchTrueFalseTotal
if ($run_allow_installing_within_test) 4 0 4
3819 4 my($allow_installing, $why) = $self->_allow_installing;
3820 4 ▶ if (! $allow_installing) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($allow_installing) 0 4 4
3821 0 $CPAN::Frontend->mywarn("Testing/Installation stopped: $why\n");
3822 0 $self->introduce_myself;
3823 0 $self->{make_test} = CPAN::Distrostatus->new("NO -- testing/installation stopped due $why");
3824 0 $CPAN::Frontend->mywarn(" [testing] -- NOT OK\n");
3825 0 delete $self->{force_update};
3826 0 $self->post_test();
3827 0 return;
3828 }
3829 }
3830 4 $CPAN::Frontend->myprint(sprintf "Running %s test for %s\n", $make, $self->pretty_id);
3831  
3832 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
3833 $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n");
3834  
3835 4 ▶ unless (chdir $builddir) {
Branch: 1 branch
BranchTrueFalseTotal
unless (CPAN::Distribution::chdir($builddir)) 0 4 4
3836 0 $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!");
3837 0 $self->post_test();
3838 0 return;
3839 }
3840  
3841 4 ▶ $self->debug("Changed directory to $self->{build_dir}")
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 4 4
3842 if $CPAN::DEBUG;
3843  
3844 4 ▶ if ($self->{modulebuild}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"modulebuild"}) 0 4 4
3845 0 my $thm = CPAN::Shell->expand("Module","Test::Harness");
3846 0 my $v = $thm->inst_version;
3847 0 ▶ if (CPAN::Version->vlt($v,2.62)) {
Branch: 1 branch
BranchTrueFalseTotal
if ("CPAN::Version"->vlt($v, "2.62")) 0 0 0
3848 # XXX Eric Wilhelm reported this as a bug: klapperl:
3849 # Test::Harness 3.0 self-tests, so that should be 'unless
3850 # installing Test::Harness'
3851 0 ▶ unless ($self->id eq $thm->distribution->id) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->id eq $thm->distribution->id) 0 0 0
3852 0 $CPAN::Frontend->mywarn(qq{The version of your Test::Harness is only
3853 '$v', you need at least '2.62'. Please upgrade your Test::Harness.\n});
3854 0 $self->{make_test} = CPAN::Distrostatus->new("NO Test::Harness too old");
3855 0 $self->post_test();
3856 0 return;
3857 }
3858 }
3859 }
3860  
3861 4 ▶ if ( ! $self->{force_update} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"force_update"}) 4 0 4
3862 # bypass actual tests if "trust_test_report_history" and have a report
3863 4 my $have_tested_fcn;
3864 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
3865 && $CPAN::META->has_inst("CPAN::Reporter::History")
3866 && ( $have_tested_fcn = CPAN::Reporter::History->can("have_tested" ))) {
3867 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
3868 # Do nothing if grade was DISCARD
3869 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
3870 0 $self->{make_test} = CPAN::Distrostatus->new("YES");
3871 # if global "is_tested" has been cleared, we need to mark this to
3872 # be added to PERL5LIB if not already installed
3873 0 ▶ if ($self->tested_ok_but_not_installed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->tested_ok_but_not_installed) 0 0 0
3874 0 $CPAN::META->is_tested($self->{build_dir},$self->{make_test}{TIME});
3875 }
3876 0 $CPAN::Frontend->myprint("Found prior test report -- OK\n");
3877 0 $self->post_test();
3878 0 return;
3879 }
3880 elsif ( $reports[-1]->{grade} =~ /^(?:FAIL|NA)$/ ) {
3881 0 $self->{make_test} = CPAN::Distrostatus->new("NO");
3882 0 $self->{badtestcnt}++;
3883 0 $CPAN::Frontend->mywarn("Found prior test report -- NOT OK\n");
3884 0 $self->post_test();
3885 0 return;
3886 }
3887 }
3888 }
3889 }
3890  
3891 4 my($tests_ok, $system);
3892 4 ▶ if ($self->{static_install}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'static_install'}) { } 0 4 4
3893 0 ▶ if ($self->_should_report('test')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_should_report('test')) { } 0 0 0
3894 0 ▶ if (-e "Build" && -x _) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e 'Build' and -x _) { } 0 0 0
Condition0%0/3
-e "Build" and -x _
!ll&&!rl&&r
000
MC/DC0%0/2
-e "Build" and -x _
-e "Build" -x _
Truth table0%0/3
A and B
A= -e "Build"B= -x _
ABresult
0X0
100
111
3895 0 $system = "./Build test";
3896 } else {
3897 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
3898 26 ▶ use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
3899 0 my %seen;
3900 0 my @path = grep { length($_) } grep { !$seen{$_}++ }
3901 0 @Config{qw(binexp sitebinexp vendorbinexp)}, File::Spec->path();
3902 0 my($cpan_static) = grep { -e $_ }
3903 0 map { File::Spec->catfile($_, "cpan-static") }
3904 @path;
3905 0 ▶ $cpan_static or $CPAN::Frontend->mydie("did not find a cpan-static program in @path");
Branch: 1 branch
BranchTrueFalseTotal
$cpan_static or $CPAN::Frontend->mydie("did not find a cpan-static program in @path") 0 0 0
3906 0 $system = "\"$cpan_static\" test";
3907 }
3908 0 ▶ CPAN->debug("Determined system cmd for CPAN::Reporter::test() as '$system'") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
3909 0 $tests_ok = CPAN::Reporter::test($self, $system);
3910 } else {
3911 0 $system = "CPAN::Static::Install::test()";
3912 0 $tests_ok = eval { CPAN::Static::Install::test(); 1; };
3913 0 ▶ warn $@ if not $tests_ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $tests_ok 0 0 0
3914 }
3915 } else {
3916 4 my $prefs_test = $self->prefs->{test};
3917 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
3918 = exists $prefs_test->{commandline} ? $prefs_test->{commandline} : "") {
3919 0 $system = $commandline;
3920 0 $ENV{PERL} = CPAN::find_perl();
3921 } elsif ($self->{modulebuild}) {
3922 0 $system = sprintf "%s test", $self->_build_command();
3923 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
3924 0 my $id = $self->pretty_id;
3925 0 $CPAN::Frontend->mywarn("Alert: no 'Build' file found while trying to test '$id'");
3926 }
3927 } else {
3928 4 $system = join " ", $self->_make_command(), "test";
3929 }
3930 4 my $make_test_arg = $self->_make_phase_arg("test");
3931 4 ▶ $system = sprintf("%s%s",
Branch: 1 branch
BranchTrueFalseTotal
$make_test_arg ? : 0 4 4
3932 $system,
3933 $make_test_arg ? " $make_test_arg" : "",
3934 );
3935 4 my $test_env;
3936 4 ▶ if ($self->prefs->{test}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->prefs->{"test"}) 0 4 4
3937 0 $test_env = $self->prefs->{test}{env};
3938 }
3939 4 ▶ local @ENV{keys %$test_env} = values %$test_env if $test_env;
Branch: 1 branch
BranchTrueFalseTotal
if $test_env 0 4 4
3940 4 my $expect_model = $self->_prefs_with_expect("test");
3941 4 my $want_expect = 0;
3942 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
3943 0 my $can_expect = $CPAN::META->has_inst("Expect");
3944 0 ▶ if ($can_expect) {
Branch: 1 branch
BranchTrueFalseTotal
if ($can_expect) { } 0 0 0
3945 0 $want_expect = 1;
3946 } else {
3947 0 $CPAN::Frontend->mywarn("Expect not installed, falling back to ".
3948 "testing without\n");
3949 }
3950 }
3951  
3952 FORK: {
3953 4 my $pid = fork;
3954 4 ▶ if (! defined $pid) { # contention
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $pid) { } 0 4 4
elsif ($pid) { } 2 2 4
3955 0 warn "Contention '$!', sleeping 2";
3956 0 sleep 2;
3957 0 redo FORK;
3958 } elsif ($pid) { # parent
3959 2 ▶ if ($^O eq "MSWin32") {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 2 2
3960 0 wait;
3961 } else {
3962 2 ▶ SUPERVISE: while (waitpid($pid, WNOHANG) <= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (waitpid($pid, 1) <= 0) 15 2 17
3963 15 ▶ if ($CPAN::Signal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Signal) 0 15 15
3964 0 kill 9, -$pid;
3965 }
3966 15 sleep 1;
3967 }
3968 }
3969 2 $tests_ok = !$?;
3970 } else { # child
3971 2 ▶ POSIX::setsid() unless $^O eq "MSWin32";
Branch: 1 branch
BranchTrueFalseTotal
unless $^O eq "MSWin32" 2 0 2
3972 2 my $c_ok;
3973 2 $|=1;
3974 2 ▶ if ($want_expect) {
Branch: 2 branches
BranchTrueFalseTotal
if ($want_expect) { } 0 2 2
elsif ($self->_should_report('test')) { } 0 2 2
3975 0 ▶ if ($self->_should_report('test')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_should_report("test")) 0 0 0
3976 0 $CPAN::Frontend->mywarn("Reporting via CPAN::Reporter is currently ".
3977 "not supported when distroprefs specify ".
3978 "an interactive test\n");
3979 }
3980 0 $c_ok = $self->_run_via_expect($system,'test',$expect_model) == 0;
3981 } elsif ( $self->_should_report('test') ) {
3982 0 $c_ok = CPAN::Reporter::test($self, $system);
3983 } else {
3984 2 $c_ok = system($system) == 0;
3985 }
3986 2 exit !$c_ok;
3987 }
3988 } # FORK
3989  
3990 }
3991  
3992 {
3993 2 $self->introduce_myself;
3994 2 my $but = $self->_make_test_illuminate_prereqs();
3995 2 ▶ if ( $tests_ok ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tests_ok) { } 1 1 2
3996 1 ▶ if ($but) {
Branch: 1 branch
BranchTrueFalseTotal
if ($but) 0 1 1
3997 0 $CPAN::Frontend->mywarn("Tests succeeded but $but\n");
3998 0 $self->{make_test} = CPAN::Distrostatus->new("NO $but");
3999 0 $self->store_persistent_state;
4000 0 $self->post_test();
4001 0 return $self->goodbye("[dependencies] -- NA");
4002 }
4003 1 $CPAN::Frontend->myprint(" $system -- OK\n");
4004 1 $self->{make_test} = CPAN::Distrostatus->new("YES");
4005 1 $CPAN::META->is_tested($self->{build_dir},$self->{make_test}{TIME});
4006 # probably impossible to need the next line because badtestcnt
4007 # has a lifespan of one command
4008 1 delete $self->{badtestcnt};
4009 } else {
4010 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
4011 0 $but .= "; additionally test harness failed";
4012 0 $CPAN::Frontend->mywarn("$but\n");
4013 0 $self->{make_test} = CPAN::Distrostatus->new("NO $but");
4014 } elsif ( $self->{force_update} ) {
4015 0 $self->{make_test} = CPAN::Distrostatus->new(
4016 "NO but failure ignored because 'force' in effect"
4017 );
4018 } elsif ($CPAN::Signal) {
4019 0 $self->{make_test} = CPAN::Distrostatus->new("NO -- Interrupted");
4020 } else {
4021 1 $self->{make_test} = CPAN::Distrostatus->new("NO");
4022 }
4023 1 $self->{badtestcnt}++;
4024 1 $CPAN::Frontend->mywarn(" $system -- NOT OK\n");
4025 1 CPAN::Shell->optprint
4026 ("hint",
4027 sprintf
4028 ("//hint// to see the cpan-testers results for installing this module, try:
4029 reports %s\n",
4030 $self->pretty_id));
4031 }
4032 }
4033 2 $self->store_persistent_state;
4034  
4035 2 $self->post_test();
4036  
4037 2 ▶ return $self->{force_update} ? 1 : !! $tests_ok;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'force_update'} ? : 0 2 2
4038 }
4039  
4040 2 ▶sub _make_test_illuminate_prereqs {
Subroutine _make_test_illuminate_prereqs: called CC=14 SCAR=48.1
4041 2 my($self) = @_;
4042 2 my @prereq;
4043  
4044 # local $CPAN::DEBUG = 16; # Distribution
4045 2 for my $m (sort keys %{$self->{sponsored_mods}}) {
4046 0 ▶ next unless $self->{sponsored_mods}{$m} > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"sponsored_mods"}{$m} > 0 0 0 0
4047 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
4048 # XXX we need available_version which reflects
4049 # $ENV{PERL5LIB} so that already tested but not yet
4050 # installed modules are counted.
4051 0 my $available_version = $m_obj->available_version;
4052 0 my $available_file = $m_obj->available_file;
4053 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
4054 !CPAN::Version->vlt($available_version,$self->{prereq_pm}{$m})
4055 ) {
4056 0 ▶ CPAN->debug("m[$m] good enough available_version[$available_version]")
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4057 if $CPAN::DEBUG;
4058 ▶ } 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
4059 && (
4060 !$self->{prereq_pm}{$m}
4061 ||
4062 $self->{prereq_pm}{$m} == 0
4063 )
4064 ) {
4065 # lex Class::Accessor::Chained::Fast which has no $VERSION
4066 0 ▶ CPAN->debug("m[$m] have available_file[$available_file]")
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4067 if $CPAN::DEBUG;
4068 } else {
4069 0 ▶ push @prereq, $m
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_locally_optional(undef, $m) 0 0 0
4070 unless $self->is_locally_optional(undef, $m);
4071 }
4072 }
4073 2 my $but;
4074 2 ▶ if (@prereq) {
Branch: 1 branch
BranchTrueFalseTotal
if (@prereq) 0 2 2
4075 0 my $cnt = @prereq;
4076 0 my $which = join ",", @prereq;
4077 0 ▶ $but = $cnt == 1 ? "one dependency not OK ($which)" :
Branch: 1 branch
BranchTrueFalseTotal
$cnt == 1 ? : 0 0 0
4078 "$cnt dependencies missing ($which)";
4079 }
4080 2 $but;
4081 }
4082  
4083 15 ▶sub _prefs_with_expect {
Subroutine _prefs_with_expect: called CC=5 SCAR=25.2
4084 15 my($self,$where) = @_;
4085 15 ▶ return unless my $prefs = $self->prefs;
Branch: 1 branch
BranchTrueFalseTotal
unless my $prefs = $self->prefs 0 15 15
4086 15 ▶ return unless my $where_prefs = $prefs->{$where};
Branch: 1 branch
BranchTrueFalseTotal
unless my $where_prefs = $prefs->{$where} 15 0 15
4087 0 ▶ if ($where_prefs->{expect}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($where_prefs->{'expect'}) { } 0 0 0
elsif ($where_prefs->{'eexpect'}) { } 0 0 0
4088 return {
4089 mode => "deterministic",
4090 timeout => 15,
4091 talk => $where_prefs->{expect},
4092 0 };
4093 } elsif ($where_prefs->{"eexpect"}) {
4094 0 return $where_prefs->{"eexpect"};
4095 }
4096 0 return;
4097 }
4098  
4099 #-> sub CPAN::Distribution::clean ;
4100 0 ▶sub clean {
Subroutine clean: not called CC=16 SCAR=56.1
Pod undocumented
4101 0 my($self) = @_;
4102 0 ▶ my $make = $self->{modulebuild} ? "Build" : "make";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'modulebuild'} ? : 0 0 0
4103 0 $CPAN::Frontend->myprint(sprintf "Running %s clean for %s\n", $make, $self->pretty_id);
4104 0 ▶ unless (exists $self->{archived}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"archived"}) 0 0 0
4105 0 $CPAN::Frontend->mywarn("Distribution seems to have never been unzipped".
4106 "/untarred, nothing done\n");
4107 0 return 1;
4108 }
4109 0 ▶ unless (exists $self->{build_dir}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"build_dir"}) 0 0 0
4110 0 $CPAN::Frontend->mywarn("Distribution has no own directory, nothing to do.\n");
4111 0 return 1;
4112 }
4113 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
4114 and $self->{writemakefile}->failed
4115 ) {
4116 0 $CPAN::Frontend->mywarn("No Makefile, don't know how to 'make clean'\n");
4117 0 return 1;
4118 }
4119 EXCUSE: {
4120 0 my @e;
4121 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
4122 push @e, "make clean already called once";
4123 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
4124 }
4125 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
4126 Carp::confess("Couldn't chdir to $self->{build_dir}: $!");
4127 0 ▶ $self->debug("Changed directory to $self->{build_dir}") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4128  
4129 0 my $system;
4130 0 ▶ if ($self->{modulebuild}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'modulebuild'}) { } 0 0 0
4131 0 ▶ unless (-f "Build") {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f "Build") 0 0 0
4132 0 my $cwd = CPAN::anycwd();
4133 0 $CPAN::Frontend->mywarn("Alert: no Build file available for 'clean $self->{id}".
4134 " in cwd[$cwd]. Danger, Will Robinson!");
4135 0 $CPAN::Frontend->mysleep(5);
4136 }
4137 0 $system = sprintf "%s clean", $self->_build_command();
4138 } else {
4139 0 $system = join " ", $self->_make_command(), "clean";
4140 }
4141 0 my $system_ok = system($system) == 0;
4142 0 $self->introduce_myself;
4143 0 ▶ if ( $system_ok ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($system_ok) { } 0 0 0
4144 0 $CPAN::Frontend->myprint(" $system -- OK\n");
4145  
4146 # $self->force;
4147  
4148 # Jost Krieger pointed out that this "force" was wrong because
4149 # it has the effect that the next "install" on this distribution
4150 # will untar everything again. Instead we should bring the
4151 # object's state back to where it is after untarring.
4152  
4153 0 for my $k (qw(
4154 force_update
4155 install
4156 writemakefile
4157 make
4158 make_test
4159 )) {
4160 0 delete $self->{$k};
4161 }
4162 0 $self->{make_clean} = CPAN::Distrostatus->new("YES");
4163  
4164 } else {
4165 # Hmmm, what to do if make clean failed?
4166  
4167 0 $self->{make_clean} = CPAN::Distrostatus->new("NO");
4168 0 $CPAN::Frontend->mywarn(qq{ $system -- NOT OK\n});
4169  
4170 # 2006-02-27: seems silly to me to force a make now
4171 # $self->force("make"); # so that this directory won't be used again
4172  
4173 }
4174 0 $self->store_persistent_state;
4175 }
4176  
4177 #-> sub CPAN::Distribution::check_disabled ;
4178 7 ▶sub check_disabled {
Subroutine check_disabled: called CC=4 SCAR=16.4
Pod undocumented
4179 7 my ($self) = @_;
4180 7 ▶ $self->debug("checking disabled id[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
4181 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
4182 return sprintf(
4183 "Disabled via prefs file '%s' doc %d",
4184 $self->{prefs_file},
4185 $self->{prefs_file_doc},
4186 0 );
4187 }
4188 7 return;
4189 }
4190  
4191 #-> sub CPAN::Distribution::goto ;
4192 0 ▶sub goto {
Subroutine goto: not called CC=4 SCAR=30.0
Pod undocumented
4193 0 my($self,$goto) = @_;
4194 0 $goto = $self->normalize($goto);
4195 my $why = sprintf(
4196 "Goto '$goto' via prefs file '%s' doc %d",
4197 $self->{prefs_file},
4198 $self->{prefs_file_doc},
4199 0 );
4200 0 $self->{unwrapped} = CPAN::Distrostatus->new("NO $why");
4201 # 2007-07-16 akoenig : Better than NA would be if we could inherit
4202 # the status of the $goto distro but given the exceptional nature
4203 # of 'goto' I feel reluctant to implement it
4204 0 my $goodbye_message = "[goto] -- NA $why";
4205 0 $self->goodbye($goodbye_message);
4206  
4207 # inject into the queue
4208  
4209 0 CPAN::Queue->delete($self->id);
4210 0 CPAN::Queue->jumpqueue({qmod => $goto, reqtype => $self->{reqtype}});
4211  
4212 # and run where we left off
4213  
4214 0 my($method) = (caller(1))[3];
4215 0 my $goto_do = CPAN->instance("CPAN::Distribution",$goto);
4216 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
4217 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
4218 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
4219 0 $goto_do->{coming_from} = $self->pretty_id;
4220 0 $goto_do->$method();
4221 0 CPAN::Queue->delete_first($goto);
4222 # XXX delete_first returns undef; is that what this should return
4223 # up the call stack, eg. return $sefl->goto($goto) -- xdg, 2012-04-04
4224 }
4225  
4226 #-> sub CPAN::Distribution::shortcut_install ;
4227 # return values: undef means don't shortcut; 0 means shortcut as fail;
4228 # and 1 means shortcut as success
4229 1 ▶sub shortcut_install {
Subroutine shortcut_install: called CC=8 SCAR=31.6
Pod undocumented
4230 1 my ($self) = @_;
4231  
4232 1 ▶ $self->debug("checking previous install results[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 1 1
4233 1 ▶ if (exists $self->{install}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"install"}) 0 1 1
4234 my $text = UNIVERSAL::can($self->{install},"text") ?
4235 $self->{install}->text :
4236 0 ▶ $self->{install};
Branch: 1 branch
BranchTrueFalseTotal
UNIVERSAL::can($self->{'install'}, 'text') ? : 0 0 0
4237 0 ▶ if ($text =~ /^YES/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($text =~ /^YES/) { } 0 0 0
elsif ($text =~ /is only/) { } 0 0 0
4238 0 $CPAN::META->is_installed($self->{build_dir});
4239 0 return $self->success("Already done");
4240 } elsif ($text =~ /is only/) {
4241 # e.g. 'is only build_requires': may be overruled later
4242 0 return $self->goodbye($text);
4243 } else {
4244 # comment in Todo on 2006-02-11; maybe retry?
4245 0 return $self->goodbye("Already tried without success");
4246 }
4247 }
4248  
4249 1 for my $slot ( qw/later configure_requires_later/ ) {
4250 return $self->success($self->{$slot})
4251 2 ▶ if $self->{$slot};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{$slot} 0 2 2
4252 }
4253  
4254 1 return undef;
4255 }
4256  
4257 #-> sub CPAN::Distribution::is_being_sponsored ;
4258  
4259 # returns true if we find a distro object in the queue that has
4260 # sponsored this one
4261 0 ▶sub is_being_sponsored {
Subroutine is_being_sponsored: not called CC=7 SCAR=40.3
Pod undocumented
4262 0 my($self) = @_;
4263 0 my $iterator = CPAN::Queue->iterator;
4264 0 ▶ QITEM: while (my $q = $iterator->()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $q = &$iterator()) 0 0 0
4265 0 my $s = $q->as_string;
4266 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
4267 0 my $type = ref $obj;
4268 0 ▶ if ( $type eq 'CPAN::Distribution' ){
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "CPAN::Distribution") 0 0 0
4269 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
4270 0 ▶ return 1 if grep { $_ eq $module } $self->containsmods;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$_ eq $module;} $self->containsmods 0 0 0
4271 }
4272 }
4273 }
4274 0 return 0;
4275 }
4276  
4277 #-> sub CPAN::Distribution::install ;
4278 7 ▶sub install {
Subroutine install: called CC=52 SCAR=63.9
Pod undocumented
4279 7 my($self) = @_;
4280  
4281 7 $self->pre_install();
4282  
4283 7 ▶ if (exists $self->{cleanup_after_install_done}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"cleanup_after_install_done"}) 0 7 7
4284 0 return $self->test;
4285 }
4286  
4287 7 ▶ $self->debug("checking goto id[$self->{ID}]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
4288 7 ▶ if (my $goto = $self->prefs->{goto}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $goto = $self->prefs->{"goto"}) 0 7 7
4289 0 $self->goto($goto);
4290 0 $self->post_install();
4291 0 return;
4292 }
4293  
4294 7 ▶ unless ($self->test) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->test) 4 1 5
4295 4 $self->post_install();
4296 4 return;
4297 }
4298  
4299 1 ▶ if ( defined( my $sc = $self->shortcut_install ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $sc = $self->shortcut_install)) 0 1 1
4300 0 $self->post_install();
4301 0 return $sc;
4302 }
4303  
4304 1 ▶ if ($CPAN::Signal) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Signal) 0 1 1
4305 0 delete $self->{force_update};
4306 0 $self->post_install();
4307 0 return;
4308 }
4309  
4310 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
4311 $CPAN::Frontend->mydie("PANIC: Cannot determine build directory\n");
4312  
4313 1 ▶ unless (chdir $builddir) {
Branch: 1 branch
BranchTrueFalseTotal
unless (CPAN::Distribution::chdir($builddir)) 0 1 1
4314 0 $CPAN::Frontend->mywarn("Couldn't chdir to '$builddir': $!");
4315 0 $self->post_install();
4316 0 return;
4317 }
4318  
4319 1 ▶ $self->debug("Changed directory to $self->{build_dir}")
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 1 1
4320 if $CPAN::DEBUG;
4321  
4322 1 ▶ my $make = $self->{modulebuild} ? "Build" : "make";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'modulebuild'} ? : 0 1 1
4323 1 $CPAN::Frontend->myprint(sprintf "Running %s install for %s\n", $make, $self->pretty_id);
4324  
4325 1 my($close_ok, $system, $makeout);
4326 1 $makeout = "";
4327 1 ▶ if ($self->{static_install}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'static_install'}) { } 0 1 1
4328 0 $system = "CPAN::Static::Install::install";
4329 0 my $args = $CPAN::Config->{'mbuild_install_arg'};
4330 0 my %opts = CPAN::Static::Install::opts_from_args_string($args);
4331 0 $close_ok = eval { CPAN::Static::Install::install(%opts); 1; };
4332 0 ▶ warn $@ if not $close_ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $close_ok 0 0 0
4333 } else {
4334 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
4335 0 $system = $commandline;
4336 0 $ENV{PERL} = CPAN::find_perl();
4337 } elsif ($self->{modulebuild}) {
4338 my($mbuild_install_build_command) =
4339 exists $CPAN::HandleConfig::keys{mbuild_install_build_command} &&
4340 $CPAN::Config->{mbuild_install_build_command} ?
4341 $CPAN::Config->{mbuild_install_build_command} :
4342 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
4343 0 ▶ my $install_directive = $^O eq 'VMS' ? '"install"' : 'install';
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'VMS' ? : 0 0 0
4344 $system = sprintf("%s %s %s",
4345 $mbuild_install_build_command,
4346 $install_directive,
4347 $CPAN::Config->{mbuild_install_arg},
4348 0 );
4349 } else {
4350 1 my($make_install_make_command) = $self->_make_install_make_command();
4351 $system = sprintf("%s install %s",
4352 $make_install_make_command,
4353 $CPAN::Config->{make_install_arg},
4354 1 );
4355 }
4356  
4357 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
4358 1 my $brip = CPAN::HandleConfig->prefs_lookup($self,
4359 q{build_requires_install_policy});
4360 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
4361 1 my $id = $self->id;
4362 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
4363 1 my $want_install = "yes";
4364 1 ▶ if ($reqtype eq "b") {
Branch: 1 branch
BranchTrueFalseTotal
if ($reqtype eq "b") 0 1 1
4365 0 ▶ if ($brip eq "no") {
Branch: 2 branches
BranchTrueFalseTotal
if ($brip eq 'no') { } 0 0 0
elsif ($brip =~ m[^ask/(.+)]) { } 0 0 0
4366 0 $want_install = "no";
4367 } elsif ($brip =~ m|^ask/(.+)|) {
4368 0 my $default = $1;
4369 0 ▶ $default = "yes" unless $default =~ /^(y|n)/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $default =~ /^(y|n)/i 0 0 0
4370 0 $want_install =
4371 CPAN::Shell::colorable_makemaker_prompt
4372 ("$id is just needed temporarily during building or testing. ".
4373 "Do you want to install it permanently?",
4374 $default);
4375 }
4376 }
4377 1 ▶ unless ($want_install =~ /^y/i) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($want_install =~ /^y/i) 0 1 1
4378 0 my $is_only = "is only 'build_requires'";
4379 0 $self->{install} = CPAN::Distrostatus->new("NO -- $is_only");
4380 0 delete $self->{force_update};
4381 0 $self->goodbye("Not installing because $is_only");
4382 0 $self->post_install();
4383 0 return;
4384 }
4385 local $ENV{PERL5LIB} = defined($ENV{PERL5LIB})
4386 ? $ENV{PERL5LIB}
4387 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
4388  
4389 1 ▶ local $ENV{PERL5OPT} = defined $ENV{PERL5OPT} ? $ENV{PERL5OPT} : "";
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'PERL5OPT'} ? : 1 0 1
4390 local $ENV{PERL_USE_UNSAFE_INC} =
4391 exists $ENV{PERL_USE_UNSAFE_INC} && defined $ENV{PERL_USE_UNSAFE_INC}
4392 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
4393 1 $CPAN::META->set_perl5lib;
4394 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
4395 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
4396  
4397 1 my $install_env;
4398 1 ▶ if ($self->prefs->{install}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->prefs->{"install"}) 1 0 1
4399 1 $install_env = $self->prefs->{install}{env};
4400 }
4401 1 ▶ local @ENV{keys %$install_env} = values %$install_env if $install_env;
Branch: 1 branch
BranchTrueFalseTotal
if $install_env 0 1 1
4402  
4403 1 ▶ if (! $run_allow_installing_within_test) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($run_allow_installing_within_test) 0 1 1
4404 0 my($allow_installing, $why) = $self->_allow_installing;
4405 0 ▶ if (! $allow_installing) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($allow_installing) 0 0 0
4406 0 $CPAN::Frontend->mywarn("Installation stopped: $why\n");
4407 0 $self->introduce_myself;
4408 0 $self->{install} = CPAN::Distrostatus->new("NO -- installation stopped due $why");
4409 0 $CPAN::Frontend->mywarn(" $system -- NOT OK\n");
4410 0 delete $self->{force_update};
4411 0 $self->post_install();
4412 0 return;
4413 }
4414 }
4415 1 my($pipe) = FileHandle->new("$system $stderr |");
4416 1 ▶ unless ($pipe) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($pipe) 0 1 1
4417 0 $CPAN::Frontend->mywarn("Can't execute $system: $!");
4418 0 $self->introduce_myself;
4419 0 $self->{install} = CPAN::Distrostatus->new("NO");
4420 0 $CPAN::Frontend->mywarn(" $system -- NOT OK\n");
4421 0 delete $self->{force_update};
4422 0 $self->post_install();
4423 0 return;
4424 }
4425 1 ▶ while (<$pipe>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $pipe)) 6 1 7
4426 6 print $_; # intentionally NOT use Frontend->myprint because it
4427 # looks irritating when we markup in color what we
4428 # just pass through from an external program
4429 6 $makeout .= $_;
4430 }
4431 1 $pipe->close;
4432 1 $close_ok = $? == 0;
4433 }
4434 {
4435 1 $self->introduce_myself;
4436 1 ▶ if ( $close_ok ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($close_ok) { } 1 0 1
4437 1 $CPAN::Frontend->myprint(" $system -- OK\n");
4438 1 $CPAN::META->is_installed($self->{build_dir});
4439 1 $self->{install} = CPAN::Distrostatus->new("YES");
4440 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
4441 && ! $self->is_dot_dist
4442 && ! $self->is_being_sponsored) {
4443 0 my $parent = File::Spec->catdir( $self->{build_dir}, File::Spec->updir );
4444 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
4445 0 File::Path::rmtree($self->{build_dir});
4446 0 my $yml = "$self->{build_dir}.yml";
4447 0 ▶ if (-e $yml) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $yml) 0 0 0
4448 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
4449 }
4450 0 $self->{cleanup_after_install_done}=1;
4451 }
4452 } else {
4453 0 $self->{install} = CPAN::Distrostatus->new("NO");
4454 0 $CPAN::Frontend->mywarn(" $system -- NOT OK\n");
4455 0 my $mimc =
4456 CPAN::HandleConfig->prefs_lookup($self,
4457 q{make_install_make_command});
4458 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
4459 $makeout =~ /permission/s
4460 && $> > 0
4461 && (
4462 ! $mimc
4463 || $mimc eq (CPAN::HandleConfig->prefs_lookup($self,
4464 q{make}))
4465 )
4466 ) {
4467 0 $CPAN::Frontend->myprint(
4468 qq{----\n}.
4469 qq{ You may have to su }.
4470 qq{to root to install the package\n}.
4471 qq{ (Or you may want to run something like\n}.
4472 qq{ o conf make_install_make_command 'sudo make'\n}.
4473 qq{ to raise your permissions.}
4474 );
4475 }
4476 }
4477 1 delete $self->{force_update};
4478 1 ▶ unless ($CPAN::Config->{'cleanup_after_install'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::Config->{"cleanup_after_install"}) 1 0 1
4479 1 $self->store_persistent_state;
4480 }
4481 }
4482  
4483 1 $self->post_install();
4484  
4485 1 return !! $close_ok;
4486 }
4487  
4488 0 ▶sub blib_pm_walk {
Subroutine blib_pm_walk: not called CC=1 SCAR=6.9
Pod undocumented
4489 0 my @queue = grep { -e $_ } File::Spec->catdir("blib","lib"), File::Spec->catdir("blib","arch");
4490 0 ▶ return sub {
Subroutine __ANON__: not called CC=9 SCAR=45.0
4491 LOOP: {
4492 0 ▶ if (@queue) {
Branch: 1 branch
BranchTrueFalseTotal
if (@queue) { } 0 0 0
4493 0 my $file = shift @queue;
4494 0 ▶ if (-d $file) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $file) { } 0 0 0
4495 0 my $dh;
4496 0 ▶ opendir $dh, $file or next;
Branch: 1 branch
BranchTrueFalseTotal
opendir $dh, $file or next 0 0 0
4497 my @newfiles = map {
4498 0 my @ret;
4499 0 my $maybedir = File::Spec->catdir($file, $_);
4500 0 ▶ if (-d $maybedir) {
Branch: 2 branches
BranchTrueFalseTotal
if (-d $maybedir) { } 0 0 0
elsif (/\.pm$/) { } 0 0 0
4501 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
4502 # prune the blib/arch/auto directory, no pm files there
4503 0 @ret = $maybedir;
4504 }
4505 } elsif (/\.pm$/) {
4506 0 my $mustbefile = File::Spec->catfile($file, $_);
4507 0 ▶ if (-f $mustbefile) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $mustbefile) 0 0 0
4508 0 @ret = $mustbefile;
4509 }
4510 }
4511 0 @ret;
4512 } grep {
4513 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
4514 && $_ ne ".."
4515 } readdir $dh;
4516 0 push @queue, @newfiles;
4517 0 redo LOOP;
4518 } else {
4519 0 return $file;
4520 }
4521 } else {
4522 0 return;
4523 }
4524 }
4525 0 };
4526 }
4527  
4528 4 ▶sub _allow_installing {
Subroutine _allow_installing: called CC=35 SCAR=68.4
4529 4 my($self) = @_;
4530 4 my $id = my $pretty_id = $self->pretty_id;
4531 4 ▶ if ($self->{CALLED_FOR}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"CALLED_FOR"}) 4 0 4
4532 4 $id .= " (called for $self->{CALLED_FOR})";
4533 }
4534 4 my $allow_down = CPAN::HandleConfig->prefs_lookup($self,q{allow_installing_module_downgrades});
4535 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
4536 4 my $allow_outdd = CPAN::HandleConfig->prefs_lookup($self,q{allow_installing_outdated_dists});
4537 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
4538 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
4539 $allow_down eq "yes"
4540 && $allow_outdd eq "yes";
4541 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
4542 0 ▶ return 1 if grep { $_ eq 'CPAN::DistnameInfo'} $self->containsmods;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$_ eq "CPAN::DistnameInfo";} $self->containsmods 0 0 0
4543 0 ▶ if ($allow_outdd ne "yes") {
Branch: 1 branch
BranchTrueFalseTotal
if ($allow_outdd ne "yes") 0 0 0
4544 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");
4545 0 $allow_outdd = "yes";
4546 }
4547 }
4548 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
4549 $allow_down eq "yes"
4550 && $allow_outdd eq "yes";
4551 0 my($dist_version, $dist_dist);
4552 0 ▶ if ($allow_outdd ne "yes"){
Branch: 1 branch
BranchTrueFalseTotal
if ($allow_outdd ne "yes") 0 0 0
4553 0 my $dni = CPAN::DistnameInfo->new($pretty_id);
4554 0 $dist_version = $dni->version;
4555 0 $dist_dist = $dni->dist;
4556 }
4557 0 my $iterator = blib_pm_walk();
4558 0 my(@down,@outdd);
4559 0 ▶ while (my $file = $iterator->()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $file = &$iterator()) 0 0 0
4560 0 my $version = CPAN::Module->parse_version($file);
4561 0 my($volume, $directories, $pmfile) = File::Spec->splitpath( $file );
4562 0 my @dirs = File::Spec->splitdir( $directories );
4563 0 my(@blib_plus1) = splice @dirs, 0, 2;
4564 0 my($pmpath) = File::Spec->catfile(grep { length($_) } @dirs, $pmfile);
4565 0 ▶ unless ($allow_down eq "yes") {
Branch: 1 branch
BranchTrueFalseTotal
unless ($allow_down eq "yes") 0 0 0
4566 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
4567 0 my $inst_version = CPAN::Module->parse_version($inst_file);
4568 0 my $cmp = CPAN::Version->vcmp($version, $inst_version);
4569 0 ▶ if ($cmp) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmp) 0 0 0
4570 0 ▶ if ($cmp < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmp < 0) 0 0 0
4571 0 push @down, { pmpath => $pmpath, version => $version, inst_version => $inst_version };
4572 }
4573 }
4574 0 ▶ if (@down) {
Branch: 1 branch
BranchTrueFalseTotal
if (@down) 0 0 0
4575 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}')";
4576 0 ▶ if (my($default) = $allow_down =~ m|^ask/(.+)|) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($default) = $allow_down =~ m[^ask/(.+)]) 0 0 0
4577 0 ▶ $default = "yes" unless $default =~ /^(y|n)/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $default =~ /^(y|n)/i 0 0 0
4578 0 my $answer = CPAN::Shell::colorable_makemaker_prompt
4579 ("$why. Do you want to allow installing it?",
4580 $default, "colorize_warn");
4581 0 ▶ $allow_down = $answer =~ /^\s*y/i ? "yes" : "no";
Branch: 1 branch
BranchTrueFalseTotal
$answer =~ /^\s*y/i ? : 0 0 0
4582 }
4583 0 ▶ if ($allow_down eq "no") {
Branch: 1 branch
BranchTrueFalseTotal
if ($allow_down eq "no") 0 0 0
4584 0 return (0, $why);
4585 }
4586 }
4587 }
4588 }
4589 0 ▶ unless ($allow_outdd eq "yes") {
Branch: 1 branch
BranchTrueFalseTotal
unless ($allow_outdd eq "yes") 0 0 0
4590 0 my @pmpath = (@dirs, $pmfile);
4591 0 $pmpath[-1] =~ s/\.pm$//;
4592 0 my $mo = CPAN::Shell->expand("Module",join "::", grep { length($_) } @pmpath);
4593 0 ▶ if ($mo) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mo) 0 0 0
4594 0 my $cpan_version = $mo->cpan_version;
4595 0 my $is_lower = CPAN::Version->vlt($version, $cpan_version);
4596 0 my $other_dist;
4597 0 ▶ if (my $mo_dist = $mo->distribution) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $mo_dist = $mo->distribution) 0 0 0
4598 0 $other_dist = $mo_dist->pretty_id;
4599 0 my $dni = CPAN::DistnameInfo->new($other_dist);
4600 0 ▶ if ($dni->dist eq $dist_dist){
Branch: 1 branch
BranchTrueFalseTotal
if ($dni->dist eq $dist_dist) 0 0 0
4601 0 ▶ if (CPAN::Version->vgt($dni->version, $dist_version)) {
Branch: 1 branch
BranchTrueFalseTotal
if ("CPAN::Version"->vgt($dni->version, $dist_version)) 0 0 0
4602 0 push @outdd, {
4603 pmpath => $pmpath,
4604 cpan_path => $dni->pathname,
4605 dist_version => $dni->version,
4606 dist_dist => $dni->dist,
4607 };
4608 }
4609 }
4610 }
4611 }
4612 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
4613 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}')";
4614 0 ▶ if ($outdd[0]{dist_dist} eq $dist_dist) {
Branch: 1 branch
BranchTrueFalseTotal
if ($outdd[0]{"dist_dist"} eq $dist_dist) 0 0 0
4615 0 $why .= ", and this has a higher distribution-version, i.e. version '$outdd[0]{dist_version}' is higher than '$dist_version')";
4616 }
4617 0 ▶ if (my($default) = $allow_outdd =~ m|^ask/(.+)|) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($default) = $allow_outdd =~ m[^ask/(.+)]) 0 0 0
4618 0 ▶ $default = "yes" unless $default =~ /^(y|n)/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $default =~ /^(y|n)/i 0 0 0
4619 0 my $answer = CPAN::Shell::colorable_makemaker_prompt
4620 ("$why. Do you want to allow installing it?",
4621 $default, "colorize_warn");
4622 0 ▶ $allow_outdd = $answer =~ /^\s*y/i ? "yes" : "no";
Branch: 1 branch
BranchTrueFalseTotal
$answer =~ /^\s*y/i ? : 0 0 0
4623 }
4624 0 ▶ if ($allow_outdd eq "no") {
Branch: 1 branch
BranchTrueFalseTotal
if ($allow_outdd eq "no") 0 0 0
4625 0 return (0, $why);
4626 }
4627 }
4628 }
4629 }
4630 0 return 1;
4631 }
4632  
4633 0 ▶sub _file_in_path { # similar to CPAN::Module::_file_in_path
Subroutine _file_in_path: not called CC=3 SCAR=24.8
4634 0 my($self,$pmpath,$incpath) = @_;
4635 0 my($dir,@packpath);
4636 0 foreach $dir (@$incpath) {
4637 0 my $pmfile = File::Spec->catfile($dir,$pmpath);
4638 0 ▶ if (-f $pmfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $pmfile) 0 0 0
4639 0 return $pmfile;
4640 }
4641 }
4642 0 return;
4643 }
4644 7 ▶sub introduce_myself {
Subroutine introduce_myself: called CC=1 SCAR=0.0
Pod undocumented
4645 7 my($self) = @_;
4646 7 $CPAN::Frontend->myprint(sprintf(" %s\n",$self->pretty_id));
4647 }
4648  
4649 #-> sub CPAN::Distribution::dir ;
4650 16 ▶sub dir {
Subroutine dir: called CC=1 SCAR=0.0
Pod undocumented
4651 16 shift->{build_dir};
4652 }
4653  
4654 #-> sub CPAN::Distribution::perldoc ;
4655 0 ▶sub perldoc {
Subroutine perldoc: not called CC=4 SCAR=30.0
Pod undocumented
4656 0 my($self) = @_;
4657  
4658 0 my($dist) = $self->id;
4659 0 my $package = $self->called_for;
4660  
4661 0 ▶ if ($CPAN::META->has_inst("Pod::Perldocs")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst('Pod::Perldocs')) { } 0 0 0
4662 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
4663 or $CPAN::Frontend->mydie("Couldn't find executable perl\n");
4664 0 my @args = ($perl, q{-MPod::Perldocs}, q{-e},
4665 q{Pod::Perldocs->run()}, $package);
4666 0 my($wstatus);
4667 0 ▶ unless ( ($wstatus = system(@args)) == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (($wstatus = system(@args)) == 0) 0 0 0
4668 0 my $estatus = $wstatus >> 8;
4669 0 $CPAN::Frontend->myprint(qq{
4670 Function system("@args")
4671 returned status $estatus (wstat $wstatus)
4672 });
4673 }
4674 }
4675 else {
4676 0 $self->_display_url( $CPAN::Defaultdocs . $package );
4677 }
4678 }
4679  
4680 #-> sub CPAN::Distribution::_check_binary ;
4681 0 ▶sub _check_binary {
Subroutine _check_binary: not called CC=10 SCAR=47.0
4682 0 my ($dist,$shell,$binary) = @_;
4683 0 my ($pid,$out);
4684  
4685 0 ▶ $CPAN::Frontend->myprint(qq{ + _check_binary($binary)\n})
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4686 if $CPAN::DEBUG;
4687  
4688 0 ▶ if ($CPAN::META->has_inst("File::Which")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_inst('File::Which')) { } 0 0 0
4689 0 return File::Which::which($binary);
4690 } else {
4691 0 local *README;
4692 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
4693 or $CPAN::Frontend->mywarn(qq{Could not fork 'which $binary': $!\n});
4694 0 ▶ return unless $pid;
Branch: 1 branch
BranchTrueFalseTotal
unless $pid 0 0 0
4695 0 ▶ while (<README>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline README)) 0 0 0
4696 0 $out .= $_;
4697 }
4698 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
4699 or $CPAN::Frontend->mywarn("Could not run 'which $binary': $!\n")
4700 and return;
4701 }
4702  
4703 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
4704 if $CPAN::DEBUG && $out;
4705  
4706 0 return $out;
4707 }
4708  
4709 #-> sub CPAN::Distribution::_display_url ;
4710 0 ▶sub _display_url {
Subroutine _display_url: not called CC=19 SCAR=59.4
4711 0 my($self,$url) = @_;
4712 0 my($res,$saved_file,$pid,$out);
4713  
4714 0 ▶ $CPAN::Frontend->myprint(qq{ + _display_url($url)\n})
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4715 if $CPAN::DEBUG;
4716  
4717 # should we define it in the config instead?
4718 0 my $html_converter = "html2text.pl";
4719  
4720 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
4721 0 ▶ my $web_browser_out = $web_browser
Branch: 1 branch
BranchTrueFalseTotal
$web_browser ? : 0 0 0
4722 ? CPAN::Distribution->_check_binary($self,$web_browser)
4723 : undef;
4724  
4725 0 ▶ if ($web_browser_out) {
Branch: 1 branch
BranchTrueFalseTotal
if ($web_browser_out) { } 0 0 0
4726 # web browser found, run the action
4727 0 my $browser = CPAN::HandleConfig->safe_quote($CPAN::Config->{'lynx'});
4728 0 ▶ $CPAN::Frontend->myprint(qq{system[$browser $url]})
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4729 if $CPAN::DEBUG;
4730 0 $CPAN::Frontend->myprint(qq{
4731 Displaying URL
4732 $url
4733 with browser $browser
4734 });
4735 0 $CPAN::Frontend->mysleep(1);
4736 0 system("$browser $url");
4737 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
4738 } else {
4739 # web browser not found, let's try text only
4740 0 my $html_converter_out =
4741 CPAN::Distribution->_check_binary($self,$html_converter);
4742 0 $html_converter_out = CPAN::HandleConfig->safe_quote($html_converter_out);
4743  
4744 0 ▶ if ($html_converter_out ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($html_converter_out) { } 0 0 0
4745 # html2text found, run it
4746 0 $saved_file = CPAN::Distribution->_getsave_url( $self, $url );
4747 0 ▶ $CPAN::Frontend->mydie(qq{ERROR: problems while getting $url\n})
Branch: 1 branch
BranchTrueFalseTotal
unless defined $saved_file 0 0 0
4748 unless defined($saved_file);
4749  
4750 0 local *README;
4751 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
4752 or $CPAN::Frontend->mydie(qq{
4753 Could not fork '$html_converter $saved_file': $!});
4754 0 my($fh,$filename);
4755 0 ▶ if ($CPAN::META->has_usable("File::Temp")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_usable('File::Temp')) { } 0 0 0
4756 0 $fh = File::Temp->new(
4757 dir => File::Spec->tmpdir,
4758 template => 'cpan_htmlconvert_XXXX',
4759 suffix => '.txt',
4760 unlink => 0,
4761 );
4762 0 $filename = $fh->filename;
4763 } else {
4764 0 $filename = "cpan_htmlconvert_$$.txt";
4765 0 $fh = FileHandle->new();
4766 0 ▶ open $fh, ">$filename" or die;
Branch: 1 branch
BranchTrueFalseTotal
open $fh, ">$filename" or die 0 0 0
4767 }
4768 0 ▶ while (<README>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline README)) 0 0 0
4769 0 $fh->print($_);
4770 }
4771 0 ▶ close README or
Branch: 1 branch
BranchTrueFalseTotal
close README or $CPAN::Frontend->mydie("Could not run '$html_converter ${saved_file}': $!") 0 0 0
4772 $CPAN::Frontend->mydie(qq{Could not run '$html_converter $saved_file': $!});
4773 0 my $tmpin = $fh->filename;
4774 0 ▶ $CPAN::Frontend->myprint(sprintf(qq{
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4775 Run '%s %s' and
4776 saved output to %s\n},
4777 $html_converter,
4778 $saved_file,
4779 $tmpin,
4780 )) if $CPAN::DEBUG;
4781 0 close $fh;
4782 0 local *FH;
4783 0 ▶ open FH, $tmpin
Branch: 1 branch
BranchTrueFalseTotal
open FH, $tmpin or $CPAN::Frontend->mydie(qq[Could not open "$tmpin": $!]) 0 0 0
4784 or $CPAN::Frontend->mydie(qq{Could not open "$tmpin": $!});
4785 0 my $fh_pager = FileHandle->new;
4786 0 local($SIG{PIPE}) = "IGNORE";
4787 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
4788 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
4789 or $CPAN::Frontend->mydie(qq{
4790 Could not open pager '$pager': $!});
4791 0 $CPAN::Frontend->myprint(qq{
4792 Displaying URL
4793 $url
4794 with pager "$pager"
4795 });
4796 0 $CPAN::Frontend->mysleep(1);
4797 0 $fh_pager->print(<FH>);
4798 0 $fh_pager->close;
4799 } else {
4800 # coldn't find the web browser or html converter
4801 0 $CPAN::Frontend->myprint(qq{
4802 You need to install lynx or $html_converter to use this feature.});
4803 }
4804 }
4805 }
4806  
4807 #-> sub CPAN::Distribution::_getsave_url ;
4808 0 ▶sub _getsave_url {
Subroutine _getsave_url: not called CC=12 SCAR=50.5
4809 0 my($dist, $shell, $url) = @_;
4810  
4811 0 ▶ $CPAN::Frontend->myprint(qq{ + _getsave_url($url)\n})
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4812 if $CPAN::DEBUG;
4813  
4814 0 my($fh,$filename);
4815 0 ▶ if ($CPAN::META->has_usable("File::Temp")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_usable('File::Temp')) { } 0 0 0
4816 0 $fh = File::Temp->new(
4817 dir => File::Spec->tmpdir,
4818 template => "cpan_getsave_url_XXXX",
4819 suffix => ".html",
4820 unlink => 0,
4821 );
4822 0 $filename = $fh->filename;
4823 } else {
4824 0 $fh = FileHandle->new;
4825 0 $filename = "cpan_getsave_url_$$.html";
4826 }
4827 0 my $tmpin = $filename;
4828 0 ▶ if ($CPAN::META->has_usable('LWP')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->has_usable('LWP')) { } 0 0 0
4829 0 $CPAN::Frontend->myprint("Fetching with LWP:
4830 $url
4831 ");
4832 0 my $Ua;
4833 0 CPAN::LWP::UserAgent->config;
4834 0 eval { $Ua = CPAN::LWP::UserAgent->new; };
4835 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 0 0
4836 0 $CPAN::Frontend->mywarn("ERROR: CPAN::LWP::UserAgent->new dies with $@\n");
4837 0 return;
4838 } else {
4839 0 my($var);
4840 $Ua->proxy('http', $var)
4841 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
4842 $Ua->no_proxy($var)
4843 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
4844 }
4845  
4846 0 my $req = HTTP::Request->new(GET => $url);
4847 0 $req->header('Accept' => 'text/html');
4848 0 my $res = $Ua->request($req);
4849 0 ▶ if ($res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->is_success) { } 0 0 0
4850 0 ▶ $CPAN::Frontend->myprint(" + request successful.\n")
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4851 if $CPAN::DEBUG;
4852 0 print $fh $res->content;
4853 0 close $fh;
4854 0 ▶ $CPAN::Frontend->myprint(qq{ + saved content to $tmpin \n})
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
4855 if $CPAN::DEBUG;
4856 0 return $tmpin;
4857 } else {
4858 0 $CPAN::Frontend->myprint(sprintf(
4859 "LWP failed with code[%s], message[%s]\n",
4860 $res->code,
4861 $res->message,
4862 ));
4863 0 return;
4864 }
4865 } else {
4866 0 $CPAN::Frontend->mywarn(" LWP not available\n");
4867 0 return;
4868 }
4869 }
4870  
4871 #-> sub CPAN::Distribution::_build_command
4872 0 ▶sub _build_command {
Subroutine _build_command: not called CC=4 SCAR=30.0
4873 0 my($self) = @_;
4874 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
4875 # Module::Build 0.2611 and 0.2706; a fix
4876 # in M:B has been promised 2006-01-30
4877 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
4878 0 return "$perl ./Build";
4879 }
4880 elsif ($^O eq 'VMS') {
4881 0 return "$^X Build.com";
4882 }
4883 0 return "./Build";
4884 }
4885  
4886 #-> sub CPAN::Distribution::_should_report
4887 13 ▶sub _should_report {
Subroutine _should_report: called CC=13 SCAR=49.3
4888 13 my($self, $phase) = @_;
4889 13 ▶ die "_should_report() requires a 'phase' argument"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $phase 0 13 13
4890 if ! defined $phase;
4891  
4892 13 ▶ return unless $CPAN::META->has_usable("CPAN::Reporter");
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::META->has_usable("CPAN::Reporter") 13 0 13
4893  
4894 # configured
4895 0 my $test_report = CPAN::HandleConfig->prefs_lookup($self,
4896 q{test_report});
4897 0 ▶ return unless $test_report;
Branch: 1 branch
BranchTrueFalseTotal
unless $test_report 0 0 0
4898  
4899 # don't repeat if we cached a result
4900 return $self->{should_report}
4901 0 ▶ if exists $self->{should_report};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"should_report"} 0 0 0
4902  
4903 # don't report if we generated a Makefile.PL
4904 0 ▶ if ( $self->{had_no_makefile_pl} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"had_no_makefile_pl"}) 0 0 0
4905 0 $CPAN::Frontend->mywarn(
4906 "Will not send CPAN Testers report with generated Makefile.PL.\n"
4907 );
4908 0 return $self->{should_report} = 0;
4909 }
4910  
4911 # available
4912 0 ▶ if ( ! $CPAN::META->has_inst("CPAN::Reporter")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_inst("CPAN::Reporter")) 0 0 0
4913 0 $CPAN::Frontend->mywarnonce(
4914 "CPAN::Reporter not installed. No reports will be sent.\n"
4915 );
4916 0 return $self->{should_report} = 0;
4917 }
4918  
4919 # capable
4920 0 my $crv = CPAN::Reporter->VERSION;
4921 0 ▶ if ( CPAN::Version->vlt( $crv, 0.99 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ("CPAN::Version"->vlt($crv, "0.99")) 0 0 0
4922 # don't cache $self->{should_report} -- need to check each phase
4923 0 ▶ if ( $phase eq 'test' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($phase eq 'test') { } 0 0 0
4924 0 return 1;
4925 }
4926 else {
4927 0 $CPAN::Frontend->mywarn(
4928 "Reporting on the '$phase' phase requires CPAN::Reporter 0.99, but \n" .
4929 "you only have version $crv\. Only 'test' phase reports will be sent.\n"
4930 );
4931 0 return;
4932 }
4933 }
4934  
4935 # appropriate
4936 0 ▶ if ($self->is_dot_dist) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_dot_dist) 0 0 0
4937 0 $CPAN::Frontend->mywarn("Reporting via CPAN::Reporter is disabled ".
4938 "for local directories\n");
4939 0 return $self->{should_report} = 0;
4940 }
4941 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
4942 &&
4943 0 @{$self->prefs->{patches}}
4944 &&
4945 $self->{patched}
4946 ) {
4947 0 $CPAN::Frontend->mywarn("Reporting via CPAN::Reporter is disabled ".
4948 "when the source has been patched\n");
4949 0 return $self->{should_report} = 0;
4950 }
4951  
4952 # proceed and cache success
4953 0 return $self->{should_report} = 1;
4954 }
4955  
4956 #-> sub CPAN::Distribution::reports
4957 0 ▶sub reports {
Subroutine reports: not called CC=27 SCAR=66.3
Pod undocumented
4958 0 my($self) = @_;
4959 0 my $pathname = $self->id;
4960 0 $CPAN::Frontend->myprint("Distribution: $pathname\n");
4961  
4962 0 ▶ unless ($CPAN::META->has_inst("CPAN::DistnameInfo")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_inst("CPAN::DistnameInfo")) 0 0 0
4963 0 $CPAN::Frontend->mydie("CPAN::DistnameInfo not installed; cannot continue");
4964 }
4965 0 ▶ unless ($CPAN::META->has_usable("LWP")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_usable("LWP")) 0 0 0
4966 0 $CPAN::Frontend->mydie("LWP not installed; cannot continue");
4967 }
4968 0 ▶ unless ($CPAN::META->has_usable("File::Temp")) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CPAN::META->has_usable("File::Temp")) 0 0 0
4969 0 $CPAN::Frontend->mydie("File::Temp not installed; cannot continue");
4970 }
4971  
4972 0 my $format;
4973 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
4974 0 $format = 'yaml';
4975 }
4976 ▶ 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
4977 0 $format = 'json';
4978 }
4979 else {
4980 0 $CPAN::Frontend->mydie("JSON::PP not installed, cannot continue");
4981 }
4982  
4983 0 my $d = CPAN::DistnameInfo->new($pathname);
4984  
4985 0 my $dist = $d->dist; # "CPAN-DistnameInfo"
4986 0 my $version = $d->version; # "0.02"
4987 0 my $maturity = $d->maturity; # "released"
4988 0 my $filename = $d->filename; # "CPAN-DistnameInfo-0.02.tar.gz"
4989 0 my $cpanid = $d->cpanid; # "GBARR"
4990 0 my $distvname = $d->distvname; # "CPAN-DistnameInfo-0.02"
4991  
4992 0 my $url = sprintf "http://www.cpantesters.org/show/%s.%s", $dist, $format;
4993  
4994 0 CPAN::LWP::UserAgent->config;
4995 0 my $Ua;
4996 0 eval { $Ua = CPAN::LWP::UserAgent->new; };
4997 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
4998 0 $CPAN::Frontend->mydie("CPAN::LWP::UserAgent->new dies with $@\n");
4999 }
5000 0 $CPAN::Frontend->myprint("Fetching '$url'...");
5001 0 my $resp = $Ua->get($url);
5002 0 ▶ unless ($resp->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($resp->is_success) 0 0 0
5003 0 $CPAN::Frontend->mydie(sprintf "Could not download '%s': %s\n", $url, $resp->code);
5004 }
5005 0 $CPAN::Frontend->myprint("DONE\n\n");
5006 0 my $unserialized;
5007 0 ▶ if ( $format eq 'yaml' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($format eq 'yaml') { } 0 0 0
5008 0 my $yaml = $resp->content;
5009 # what a long way round!
5010 0 my $fh = File::Temp->new(
5011 dir => File::Spec->tmpdir,
5012 template => 'cpan_reports_XXXX',
5013 suffix => '.yaml',
5014 unlink => 0,
5015 );
5016 0 my $tfilename = $fh->filename;
5017 0 print $fh $yaml;
5018 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
5019 0 $unserialized = CPAN->_yaml_loadfile($tfilename)->[0];
5020 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
5021 } else {
5022 0 require JSON::PP;
5023 0 $unserialized = JSON::PP->new->utf8->decode($resp->content);
5024 }
5025 0 my %other_versions;
5026 my $this_version_seen;
5027 0 for my $rep (@$unserialized) {
5028 0 my $rversion = $rep->{version};
5029 0 ▶ if ($rversion eq $version) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rversion eq $version) { } 0 0 0
5030 0 ▶ unless ($this_version_seen++) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($this_version_seen++) 0 0 0
5031 0 $CPAN::Frontend->myprint ("$rep->{version}:\n");
5032 }
5033 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
5034 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
5035 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
5036 $CPAN::Frontend->myprint
5037 (sprintf("%1s%1s%-4s %s on %s %s (%s)\n",
5038 $arch eq $Config::Config{archname}?"*":"",
5039 $grade eq "PASS"?"+":$grade eq"FAIL"?"-":"",
5040 $grade,
5041 $rep->{perl},
5042 $ostext,
5043 $rep->{osvers},
5044 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
5045 ));
5046 } else {
5047 0 $other_versions{$rep->{version}}++;
5048 }
5049 }
5050 0 ▶ unless ($this_version_seen) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($this_version_seen) 0 0 0
5051 0 $CPAN::Frontend->myprint("No reports found for version '$version'
5052 Reports for other versions:\n");
5053 0 for my $v (sort keys %other_versions) {
5054 0 $CPAN::Frontend->myprint(" $v\: $other_versions{$v}\n");
5055 }
5056 }
5057 0 $url = substr($url,0,-4) . 'html';
5058 0 $CPAN::Frontend->myprint("See $url for details\n");
5059 }
5060  
5061 26 1;
« blib/lib/CPAN/Tarzip.pm ↑ Summary lib/CPAN/Admin.pm »