blib/lib/CPAN/Module.pm

filter: Statementstmt 36.7% 134 / 365 Branchbran 25.7% 54 / 210 Conditioncond 29.6% 27 / 91 MC/DCmcdc 10.9% 6 / 55 Subroutinesub 50.0% 21 / 42 Podpod 0.0% 0 / 34 totaltotal 30.3% 242 / 797 CC 150 SCAR 55.2
CC
150
Cov
32%
as_string
1190.0
manpage_headline
156.0
color_cmd_tmps
95.8
CRAP 250.4
« blib/lib/CPAN/Tarzip.pm ↑ Summary blib/lib/CPAN/Mirrors.pm »
1 # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*-
2 # vim: ts=4 sts=4 sw=4:
3 package CPAN::Module;
4 24 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 24 @CPAN::Module::ISA = qw(CPAN::InfoObj);
6  
7 24 use vars qw(
8 $VERSION
9 24 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 24 $VERSION = "5.5003";
11  
12 BEGIN {
13 # alarm() is not implemented in perl 5.6.x and earlier under Windows
14 24 ▶ *ALARM_IMPLEMENTED = sub () { $] >= 5.007 || $^O !~ /MSWin/ };
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
$] >= "5.007" or not $^O =~ /MSWin/ 0 34 34
15 }
16  
17 # Accessors
18 #-> sub CPAN::Module::userid
19 sub userid {
20 48 ▶ my $self = shift;
Subroutine userid: called CC=3 SCAR=15.1
Pod undocumented
21 48 my $ro = $self->ro;
22 48 ▶ return unless $ro;
Branch: 1 branch
BranchTrueFalseTotal
unless $ro 48 0 48
23 0 ▶ return $ro->{userid} || $ro->{CPAN_USERID};
Condition0%0/3
$ro->{'userid'} || $ro->{'CPAN_USERID'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$ro->{'userid'} || $ro->{'CPAN_USERID'}
$ro->{'userid'} $ro->{'CPAN_USERID'}
Truth table0%0/3
A || B
A= $ro->{'userid'}B= $ro->{'CPAN_USERID'}
ABresult
1X1
011
000
24 }
25 #-> sub CPAN::Module::description
26 sub description {
27 0 ▶ my $self = shift;
Subroutine description: not called CC=2 SCAR=17.9
Pod undocumented
28 0 ▶ my $ro = $self->ro or return "";
Branch: 1 branch
BranchTrueFalseTotal
my $ro = $self->ro or return "" 0 0 0
29 $ro->{description}
30 0 }
31  
32 #-> sub CPAN::Module::distribution
33 sub distribution {
34 8 ▶ my($self) = @_;
Subroutine distribution: called CC=1 SCAR=0.0
Pod undocumented
35 8 CPAN::Shell->expand("Distribution",$self->cpan_file);
36 }
37  
38 #-> sub CPAN::Module::_is_representative_module
39 sub _is_representative_module {
40 0 ▶ my($self) = @_;
Subroutine _is_representative_module: not called CC=4 SCAR=30.0
41 0 ▶ return $self->{_is_representative_module} if defined $self->{_is_representative_module};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"_is_representative_module"} 0 0 0
42 0 ▶ my $pm = $self->cpan_file or return $self->{_is_representative_module} = 0;
Branch: 1 branch
BranchTrueFalseTotal
my $pm = $self->cpan_file or return $self->{"_is_representative_module"} = 0 0 0 0
43 0 $pm =~ s|.+/||;
44 0 $pm =~ s{\.(?:tar\.(bz2|gz|Z)|t(?:gz|bz)|zip)$}{}i; # see base_id
45 0 $pm =~ s|-\d+\.\d+.+$||;
46 0 $pm =~ s|-[\d\.]+$||;
47 0 $pm =~ s/-/::/g;
48 0 ▶ $self->{_is_representative_module} = $pm eq $self->{ID} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$pm eq $self->{'ID'} ? : 0 0 0
49 # warn "DEBUG: $pm eq $self->{ID} => $self->{_is_representative_module}";
50 0 $self->{_is_representative_module};
51 }
52  
53 #-> sub CPAN::Module::undelay
54 sub undelay {
55 5 ▶ my $self = shift;
Subroutine undelay: called CC=2 SCAR=7.0
Pod undocumented
56 5 delete $self->{later};
57 5 ▶ if ( my $dist = CPAN::Shell->expand("Distribution", $self->cpan_file) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $dist = "CPAN::Shell"->expand("Distribution", $self->cpan_file)) 5 0 5
58 5 $dist->undelay;
59 }
60 }
61  
62 # mark as dirty/clean
63 #-> sub CPAN::Module::color_cmd_tmps ;
64 sub color_cmd_tmps {
65 21 ▶ my($self) = shift;
Subroutine color_cmd_tmps: called CC=22 SCAR=45.6
Pod undocumented
66 21 ▶ my($depth) = shift || 0;
Condition100%2/2
shift() || 0
l!l
417
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
67 21 ▶ my($color) = shift || 0;
Condition100%2/2
shift() || 0
l!l
714
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
68 21 ▶ my($ancestors) = shift || [];
Condition100%2/2
shift() || []
l!l
417
MC/DC100%1/1
shift() || []
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
69 # a module needs to recurse to its cpan_file
70  
71 return if exists $self->{incommandcolor}
72 && $color==1
73 21 ▶ && $self->{incommandcolor}==$color;
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"incommandcolor"} and $color == 1 and $self->{"incommandcolor"} == $color 0 21 21
Condition50%3/6
exists $self->{"incommandcolor"} and $color == 1 and $self->{"incommandcolor"} == $color
!ll&&!rl&&r
2100
exists $self->{"incommandcolor"} and $color == 1
!ll&&!rl&&r
11100
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
74 21 ▶ return if $color==0 && !$self->{incommandcolor};
Branch: 1 branch
BranchTrueFalseTotal
if $color == 0 and not $self->{"incommandcolor"} 9 12 21
Condition100%3/3
$color == 0 and not $self->{"incommandcolor"}
!ll&&!rl&&r
759
MC/DC100%2/2
$color == 0 and not $self->{"incommandcolor"}
$color == 0 not $self->{"incommandcolor"}
Truth table100%3/3
A and not(B)
A= $color == 0B= not $self->{"incommandcolor"}
ABresult
0X0
100
111
75 12 ▶ if ($color>=1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($color >= 1) { } 7 5 12
76 7 ▶ if ( $self->uptodate ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->uptodate) { } 0 7 7
elsif (my $have_version = $self->available_version) { } 0 7 7
77 0 $self->{incommandcolor} = $color;
78 0 return;
79 } elsif (my $have_version = $self->available_version) {
80 # maybe what we have is good enough
81 0 ▶ if (@$ancestors) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$ancestors) 0 0 0
82 0 my $who_asked_for_me = $ancestors->[-1];
83 0 my $obj = CPAN::Shell->expandany($who_asked_for_me);
84 0 ▶ if (0) {
Branch: 2 branches
BranchTrueFalseTotal
if (do { $obj->isa('CPAN::Bundle') }) { } 0 0 0
elsif ($obj->isa('CPAN::Distribution')) { } 0 0 0
85 } elsif ($obj->isa("CPAN::Bundle")) {
86 # bundles cannot specify a minimum version
87 0 return;
88 } elsif ($obj->isa("CPAN::Distribution")) {
89 0 ▶ if (my $prereq_pm = $obj->prereq_pm) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $prereq_pm = $obj->prereq_pm) 0 0 0
90 0 for my $k (keys %$prereq_pm) {
91 0 ▶ if (my $want_version = $prereq_pm->{$k}{$self->id}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $want_version = $prereq_pm->{$k}{$self->id}) 0 0 0
92 0 ▶ if (CPAN::Version->vcmp($have_version,$want_version) >= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ("CPAN::Version"->vcmp($have_version, $want_version) >= 0) 0 0 0
93 0 $self->{incommandcolor} = $color;
94 0 return;
95 }
96 }
97 }
98 }
99 }
100 }
101 }
102 } else {
103 5 $self->{incommandcolor} = $color; # set me before recursion,
104 # so we can break it
105 }
106 12 ▶ if ($depth>=$CPAN::MAX_RECURSION) {
Branch: 1 branch
BranchTrueFalseTotal
if ($depth >= $CPAN::MAX_RECURSION) 0 12 12
107 0 my $e = CPAN::Exception::RecursiveDependency->new($ancestors);
108 0 ▶ if ($e->is_resolvable) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e->is_resolvable) { } 0 0 0
109 0 return $self->{incommandcolor}=2;
110 } else {
111 0 die $e;
112 }
113 }
114 # warn "color_cmd_tmps $depth $color " . $self->id; # sleep 1;
115  
116 12 ▶ if ( my $dist = CPAN::Shell->expand("Distribution", $self->cpan_file) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $dist = "CPAN::Shell"->expand("Distribution", $self->cpan_file)) 12 0 12
117 12 $dist->color_cmd_tmps($depth+1,$color,[@$ancestors, $self->id]);
118 }
119 # unreached code?
120 # if ($color==0) {
121 # delete $self->{badtestcnt};
122 # }
123 12 $self->{incommandcolor} = $color;
124 }
125  
126 #-> sub CPAN::Module::as_glimpse ;
127 sub as_glimpse {
128 0 ▶ my($self) = @_;
Subroutine as_glimpse: not called CC=8 SCAR=42.8
Pod undocumented
129 0 my(@m);
130 0 my $class = ref($self);
131 0 $class =~ s/^CPAN:://;
132 0 my $color_on = "";
133 0 my $color_off = "";
134 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Shell::COLOR_REGISTERED and $CPAN::META->has_inst("Term::ANSIColor") and $self->description) 0 0 0
Condition0%0/6
$CPAN::Shell::COLOR_REGISTERED and $CPAN::META->has_inst("Term::ANSIColor") and $self->description
!ll&&!rl&&r
000
$CPAN::Shell::COLOR_REGISTERED and $CPAN::META->has_inst("Term::ANSIColor")
!ll&&!rl&&r
000
MC/DC0%0/3
$CPAN::Shell::COLOR_REGISTERED and $CPAN::META->has_inst("Term::ANSIColor") and $self->description
$CPAN::Shell::COLOR_REGISTERED $CPAN::META->has_inst("Term::ANSIColor") $self->description
Truth table0%0/4
A and B and C
A= $CPAN::Shell::COLOR_REGISTEREDB= $CPAN::META->has_inst("Term::ANSIColor")C= $self->description
ABCresult
0XX0
10X0
1100
1111
135 $CPAN::Shell::COLOR_REGISTERED
136 &&
137 $CPAN::META->has_inst("Term::ANSIColor")
138 &&
139 $self->description
140 ) {
141 0 $color_on = Term::ANSIColor::color("green");
142 0 $color_off = Term::ANSIColor::color("reset");
143 }
144 0 my $uptodateness = " ";
145 0 ▶ unless ($class eq "Bundle") {
Branch: 1 branch
BranchTrueFalseTotal
unless ($class eq "Bundle") 0 0 0
146 0 my $u = $self->uptodate;
147 0 ▶ $uptodateness = $u ? "=" : "<" if defined $u;
Branch: 2 branches
BranchTrueFalseTotal
if defined $u 0 0 0
$u ? : 0 0 0
148 };
149 0 my $id = do {
150 0 my $d = $self->distribution;
151 0 ▶ $d ? $d -> pretty_id : $self->cpan_userid;
Branch: 1 branch
BranchTrueFalseTotal
$d ? : 0 0 0
152 };
153 0 push @m, sprintf("%-7s %1s %s%-22s%s (%s)\n",
154 $class,
155 $uptodateness,
156 $color_on,
157 $self->id,
158 $color_off,
159 $id,
160 );
161 0 join "", @m;
162 }
163  
164 #-> sub CPAN::Module::dslip_status
165 sub dslip_status {
166 0 ▶ my($self) = @_;
Subroutine dslip_status: not called CC=4 SCAR=30.0
Pod undocumented
167 0 my($stat);
168 # development status
169 0 @{$stat->{D}}{qw,i c a b R M S,} = qw,idea
170 pre-alpha alpha beta released
171 mature standard,;
172 # support level
173 0 @{$stat->{S}}{qw,m d u n a,} = qw,mailing-list
174 developer comp.lang.perl.*
175 none abandoned,;
176 # language
177 0 @{$stat->{L}}{qw,p c + o h,} = qw,perl C C++ other hybrid,;
178 # interface
179 0 @{$stat->{I}}{qw,f r O p h n,} = qw,functions
180 references+ties
181 object-oriented pragma
182 hybrid none,;
183 # public licence
184 0 @{$stat->{P}}{qw,p g l b a 2 o d r n,} = qw,Standard-Perl
185 GPL LGPL
186 BSD Artistic Artistic_2
187 open-source
188 distribution_allowed
189 restricted_distribution
190 no_licence,;
191 0 for my $x (qw(d s l i p)) {
192 0 $stat->{$x}{' '} = 'unknown';
193 0 $stat->{$x}{'?'} = 'unknown';
194 }
195 0 my $ro = $self->ro;
196 0 ▶ return +{} unless $ro && $ro->{statd};
Branch: 1 branch
BranchTrueFalseTotal
unless $ro and $ro->{"statd"} 0 0 0
Condition0%0/3
$ro and $ro->{"statd"}
!ll&&!rl&&r
000
MC/DC0%0/2
$ro and $ro->{"statd"}
$ro $ro->{"statd"}
Truth table0%0/3
A and B
A= $roB= $ro->{"statd"}
ABresult
0X0
100
111
197 return {
198 D => $ro->{statd},
199 S => $ro->{stats},
200 L => $ro->{statl},
201 I => $ro->{stati},
202 P => $ro->{statp},
203 DV => $stat->{D}{$ro->{statd}},
204 SV => $stat->{S}{$ro->{stats}},
205 LV => $stat->{L}{$ro->{statl}},
206 IV => $stat->{I}{$ro->{stati}},
207 PV => $stat->{P}{$ro->{statp}},
208 0 };
209 }
210  
211 #-> sub CPAN::Module::as_string ;
212 sub as_string {
213 0 ▶ my($self) = @_;
Subroutine as_string: not called CC=34 SCAR=70.8
Pod undocumented
214 0 my(@m);
215 0 ▶ CPAN->debug("$self entering as_string") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
216 0 my $class = ref($self);
217 0 $class =~ s/^CPAN:://;
218 0 local($^W) = 0;
219 0 push @m, $class, " id = $self->{ID}\n";
220 0 my $sprintf = " %-12s %s\n";
221 0 ▶ push @m, sprintf($sprintf, 'DESCRIPTION', $self->description)
Branch: 1 branch
BranchTrueFalseTotal
if $self->description 0 0 0
222 if $self->description;
223 0 my $sprintf2 = " %-12s %s (%s)\n";
224 0 my($userid);
225 0 $userid = $self->userid;
226 0 ▶ if ( $userid ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($userid) 0 0 0
227 0 my $author;
228 0 ▶ if ($author = CPAN::Shell->expand('Author',$userid)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($author = "CPAN::Shell"->expand("Author", $userid)) 0 0 0
229 0 my $email = "";
230 0 my $m; # old perls
231 0 ▶ if ($m = $author->email) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m = $author->email) 0 0 0
232 0 $email = " <$m>";
233 }
234 0 push @m, sprintf(
235 $sprintf2,
236 'CPAN_USERID',
237 $userid,
238 $author->fullname . $email
239 );
240 }
241 }
242 0 ▶ push @m, sprintf($sprintf, 'CPAN_VERSION', $self->cpan_version)
Branch: 1 branch
BranchTrueFalseTotal
if $self->cpan_version 0 0 0
243 if $self->cpan_version;
244 0 ▶ if (my $cpan_file = $self->cpan_file) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $cpan_file = $self->cpan_file) 0 0 0
245 0 push @m, sprintf($sprintf, 'CPAN_FILE', $cpan_file);
246 0 ▶ if (my $dist = CPAN::Shell->expand("Distribution",$cpan_file)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $dist = "CPAN::Shell"->expand("Distribution", $cpan_file)) 0 0 0
247 0 my $upload_date = $dist->upload_date;
248 0 ▶ if ($upload_date) {
Branch: 1 branch
BranchTrueFalseTotal
if ($upload_date) 0 0 0
249 0 push @m, sprintf($sprintf, 'UPLOAD_DATE', $upload_date);
250 }
251 }
252 }
253 0 my $sprintf3 = " %-12s %1s%1s%1s%1s%1s (%s,%s,%s,%s,%s)\n";
254 0 my $dslip = $self->dslip_status;
255 push @m, sprintf(
256 $sprintf3,
257 'DSLIP_STATUS',
258 0 @{$dslip}{qw(D S L I P DV SV LV IV PV)},
259 0 ▶ ) if $dslip->{D};
Branch: 1 branch
BranchTrueFalseTotal
if $dslip->{"D"} 0 0 0
260 0 my $local_file = $self->inst_file;
261 0 ▶ unless ($self->{MANPAGE}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"MANPAGE"}) 0 0 0
262 0 my $manpage;
263 0 ▶ if ($local_file) {
Branch: 1 branch
BranchTrueFalseTotal
if ($local_file) { } 0 0 0
264 0 $manpage = $self->manpage_headline($local_file);
265 } else {
266 # If we have already untarred it, we should look there
267 0 my $dist = $CPAN::META->instance('CPAN::Distribution',
268 $self->cpan_file);
269 # warn "dist[$dist]";
270 # mff=manifest file; mfh=manifest handle
271 0 my($mff,$mfh);
272 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($dist->{"build_dir"} and -f ($mff = "File::Spec"->catfile($dist->{"build_dir"}, "MANIFEST")) and $mfh = "FileHandle"->new($mff)) 0 0 0
Condition0%0/6
$dist->{"build_dir"} and -f ($mff = "File::Spec"->catfile($dist->{"build_dir"}, "MANIFEST")) and $mfh = "FileHandle"->new($mff)
!ll&&!rl&&r
000
$dist->{"build_dir"} and -f ($mff = "File::Spec"->catfile($dist->{"build_dir"}, "MANIFEST"))
!ll&&!rl&&r
000
MC/DC0%0/3
$dist->{"build_dir"} and -f ($mff = "File::Spec"->catfile($dist->{"build_dir"}, "MANIFEST")) and $mfh = "FileHandle"->new($mff)
$dist->{"build_dir"} -f ($mff = "File::Spec"->catfile($dist->{"build_dir"}, "MANIFEST")) $mfh = "FileHandle"->new($mff)
Truth table0%0/4
A and B and C
A= $dist->{"build_dir"}B= -f ($mff = "File::Spec"->catfile($dist->{"build_dir"}, "MANIFEST"))C= $mfh = "FileHandle"->new($mff)
ABCresult
0XX0
10X0
1100
1111
273 $dist->{build_dir}
274 and
275 (-f ($mff = File::Spec->catfile($dist->{build_dir}, "MANIFEST")))
276 and
277 $mfh = FileHandle->new($mff)
278 ) {
279 0 ▶ CPAN->debug("mff[$mff]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
280 0 my $lfre = $self->id; # local file RE
281 0 $lfre =~ s/::/./g;
282 0 $lfre .= "\\.pm\$";
283 0 my($lfl); # local file file
284 0 local $/ = "\n";
285 0 my(@mflines) = <$mfh>;
286 0 for (@mflines) {
287 0 s/^\s+//;
288 0 s/\s.*//s;
289 }
290 0 ▶ while (length($lfre)>5 and !$lfl) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $lfre > 5 and not $lfl) 0 0 0
Condition0%0/3
length $lfre > 5 and not $lfl
!ll&&!rl&&r
000
MC/DC0%0/2
length $lfre > 5 and not $lfl
length $lfre > 5 not $lfl
Truth table0%0/3
A and not(B)
A= length $lfre > 5B= not $lfl
ABresult
0X0
100
111
291 0 ($lfl) = grep /$lfre/, @mflines;
292 0 ▶ CPAN->debug("lfl[$lfl]lfre[$lfre]") if $CPAN::DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 0 0
293 0 $lfre =~ s/.+?\.//;
294 }
295 0 $lfl =~ s/\s.*//; # remove comments
296 0 $lfl =~ s/\s+//g; # chomp would maybe be too system-specific
297 0 my $lfl_abs = File::Spec->catfile($dist->{build_dir},$lfl);
298 # warn "lfl_abs[$lfl_abs]";
299 0 ▶ if (-f $lfl_abs) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $lfl_abs) 0 0 0
300 0 $manpage = $self->manpage_headline($lfl_abs);
301 }
302 }
303 }
304 0 ▶ $self->{MANPAGE} = $manpage if $manpage;
Branch: 1 branch
BranchTrueFalseTotal
if $manpage 0 0 0
305 }
306 0 my($item);
307 0 for $item (qw/MANPAGE/) {
308 push @m, sprintf($sprintf, $item, $self->{$item})
309 0 ▶ if exists $self->{$item};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{$item} 0 0 0
310 }
311 0 for $item (qw/CONTAINS/) {
312 0 push @m, sprintf($sprintf, $item, join(" ",@{$self->{$item}}))
313 0 ▶ if exists $self->{$item} && @{$self->{$item}};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{$item} and @{$self->{$item};} 0 0 0
Condition0%0/3
exists $self->{$item} and @{$self->{$item};}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{$item} and @{$self->{$item};}
exists $self->{$item} @{$self->{$item};}
Truth table0%0/3
A and B
A= exists $self->{$item}B= @{$self->{$item};}
ABresult
0X0
100
111
314 }
315 0 ▶ push @m, sprintf($sprintf, 'INST_FILE',
Condition0%0/2
$local_file || '(not installed)'
l!l
00
MC/DC0%0/1
$local_file || '(not installed)'
$local_file
Truth table0%0/2
A
A= $local_file
Aresult
11
00
316 $local_file || "(not installed)");
317 0 ▶ push @m, sprintf($sprintf, 'INST_VERSION',
Branch: 1 branch
BranchTrueFalseTotal
if $local_file 0 0 0
318 $self->inst_version) if $local_file;
319 0 ▶ if (%{$CPAN::META->{is_tested}||{}}) { # XXX needs to be methodified somehow
Branch: 2 branches
BranchTrueFalseTotal
if (%{$CPAN::META->{"is_tested"} or {};}) 0 0 0
$CPAN::META->{"is_tested"} or {} 0 0 0
320 0 my $available_file = $self->available_file;
321 0 ▶ if ($available_file && $available_file ne $local_file) {
Branch: 1 branch
BranchTrueFalseTotal
if ($available_file and $available_file ne $local_file) 0 0 0
Condition0%0/3
$available_file and $available_file ne $local_file
!ll&&!rl&&r
000
MC/DC0%0/2
$available_file and $available_file ne $local_file
$available_file $available_file ne $local_file
Truth table0%0/3
A and B
A= $available_fileB= $available_file ne $local_file
ABresult
0X0
100
111
322 0 push @m, sprintf($sprintf, 'AVAILABLE_FILE', $available_file);
323 0 push @m, sprintf($sprintf, 'AVAILABLE_VERSION', $self->available_version);
324 }
325 }
326 0 join "", @m, "\n";
327 }
328  
329 #-> sub CPAN::Module::manpage_headline
330 sub manpage_headline {
331 0 ▶ my($self,$local_file) = @_;
Subroutine manpage_headline: not called CC=12 SCAR=50.5
Pod undocumented
332 0 my(@local_file) = $local_file;
333 0 $local_file =~ s/\.pm(?!\n)\Z/.pod/;
334 0 push @local_file, $local_file;
335 0 my(@result,$locf);
336 0 for $locf (@local_file) {
337 0 ▶ next unless -f $locf;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $locf 0 0 0
338 0 ▶ my $fh = FileHandle->new($locf)
Branch: 1 branch
BranchTrueFalseTotal
my $fh = "FileHandle"->new($locf) or $Carp::Frontend->mydie("Couldn't open ${locf}: $!") 0 0 0
339 or $Carp::Frontend->mydie("Couldn't open $locf: $!");
340 0 my $inpod = 0;
341 0 local $/ = "\n";
342 0 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
343 0 ▶ $inpod = m/^=(?!head1\s+NAME\s*$)/ ? 0 :
Branch: 2 branches
BranchTrueFalseTotal
/^=(?!head1\s+NAME\s*$)/ ? : 0 0 0
/^=head1\s+NAME\s*$/ ? : 0 0 0
344 m/^=head1\s+NAME\s*$/ ? 1 : $inpod;
345 0 ▶ next unless $inpod;
Branch: 1 branch
BranchTrueFalseTotal
unless $inpod 0 0 0
346 0 ▶ next if /^=/;
Branch: 1 branch
BranchTrueFalseTotal
if /^=/ 0 0 0
347 0 ▶ next if /^\s+$/;
Branch: 1 branch
BranchTrueFalseTotal
if /^\s+$/ 0 0 0
348 0 chomp;
349 0 push @result, $_;
350 }
351 0 close $fh;
352 0 ▶ last if @result;
Branch: 1 branch
BranchTrueFalseTotal
if @result 0 0 0
353 }
354 0 for (@result) {
355 0 s/^\s+//;
356 0 s/\s+$//;
357 }
358 0 join " ", @result;
359 }
360  
361 #-> sub CPAN::Module::cpan_file ;
362 # Note: also inherited by CPAN::Bundle
363 sub cpan_file {
364 86 ▶ my $self = shift;
Subroutine cpan_file: called CC=8 SCAR=28.2
Pod undocumented
365 # CPAN->debug(sprintf "id[%s]", $self->id) if $CPAN::DEBUG;
366 86 ▶ unless ($self->ro) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->ro) 24 62 86
367 24 CPAN::Index->reload;
368 }
369 86 my $ro = $self->ro;
370 86 ▶ if ($ro && defined $ro->{CPAN_FILE}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ro and defined $ro->{'CPAN_FILE'}) { } 62 24 86
Condition66%2/3
$ro and defined $ro->{"CPAN_FILE"}
!ll&&!rl&&r
24062
MC/DC50%1/2
$ro and defined $ro->{"CPAN_FILE"}
$ro defined $ro->{"CPAN_FILE"}
Truth table66%2/3
A and B
A= $roB= defined $ro->{"CPAN_FILE"}
ABresult
0X0
100
111
371 62 return $ro->{CPAN_FILE};
372 } else {
373 24 my $userid = $self->userid;
374 24 ▶ if ( $userid ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($userid) { } 0 24 24
375 0 ▶ if ($CPAN::META->exists("CPAN::Author",$userid)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::META->exists('CPAN::Author', $userid)) { } 0 0 0
376 0 my $author = $CPAN::META->instance("CPAN::Author",
377 $userid);
378 0 my $fullname = $author->fullname;
379 0 my $email = $author->email;
380 0 ▶ unless (defined $fullname && defined $email) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $fullname and defined $email) 0 0 0
Condition0%0/3
defined $fullname and defined $email
!ll&&!rl&&r
000
MC/DC0%0/2
defined $fullname and defined $email
defined $fullname defined $email
Truth table0%0/3
A and B
A= defined $fullnameB= defined $email
ABresult
0X0
100
111
381 0 return sprintf("Contact Author %s",
382 $userid,
383 );
384 }
385 0 return "Contact Author $fullname <$email>";
386 } else {
387 0 return "Contact Author $userid (Email address not available)";
388 }
389 } else {
390 24 return "N/A";
391 }
392 }
393 }
394  
395 #-> sub CPAN::Module::cpan_version ;
396 sub cpan_version {
397 39 ▶ my $self = shift;
Subroutine cpan_version: called CC=3 SCAR=11.0
Pod undocumented
398  
399 39 my $ro = $self->ro;
400 39 ▶ unless ($ro) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ro) 8 31 39
401 # Can happen with modules that are not on CPAN
402 8 $ro = {};
403 }
404 $ro->{CPAN_VERSION} = 'undef'
405 39 ▶ unless defined $ro->{CPAN_VERSION};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ro->{"CPAN_VERSION"} 8 31 39
406 39 $ro->{CPAN_VERSION};
407 }
408  
409 #-> sub CPAN::Module::force ;
410 sub force {
411 0 ▶ my($self) = @_;
Subroutine force: not called CC=1 SCAR=6.9
Pod undocumented
412 0 $self->{force_update} = 1;
413 }
414  
415 #-> sub CPAN::Module::fforce ;
416 sub fforce {
417 0 ▶ my($self) = @_;
Subroutine fforce: not called CC=1 SCAR=6.9
Pod undocumented
418 0 $self->{force_update} = 2;
419 }
420  
421 #-> sub CPAN::Module::notest ;
422 sub notest {
423 0 ▶ my($self) = @_;
Subroutine notest: not called CC=1 SCAR=6.9
Pod undocumented
424 # $CPAN::Frontend->mywarn("XDEBUG: set notest for Module");
425 0 $self->{notest}++;
426 }
427  
428 #-> sub CPAN::Module::rematein ;
429 sub rematein {
430 7 ▶ my($self,$meth) = @_;
Subroutine rematein: called CC=20 SCAR=44.7
Pod undocumented
431 7 $CPAN::Frontend->myprint(sprintf("Running %s for module '%s'\n",
432 $meth,
433 $self->id));
434 7 my $cpan_file = $self->cpan_file;
435 7 ▶ if ($cpan_file eq "N/A" || $cpan_file =~ /^Contact Author/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cpan_file eq "N/A" or $cpan_file =~ /^Contact Author/) 0 7 7
Condition33%1/3
$cpan_file eq "N/A" or $cpan_file =~ /^Contact Author/
l!l&&r!l&&!r
007
MC/DC0%0/2
$cpan_file eq "N/A" or $cpan_file =~ /^Contact Author/
$cpan_file eq "N/A" $cpan_file =~ /^Contact Author/
Truth table33%1/3
A or B
A= $cpan_file eq "N/A"B= $cpan_file =~ /^Contact Author/
ABresult
1X1
011
000
436 0 $CPAN::Frontend->mywarn(sprintf qq{
437 The module %s isn\'t available on CPAN.
438  
439 Either the module has not yet been uploaded to CPAN, or it is
440 temporary unavailable. Please contact the author to find out
441 more about the status. Try 'i %s'.
442 },
443 $self->id,
444 $self->id,
445 );
446 0 return;
447 }
448 7 my $pack = $CPAN::META->instance('CPAN::Distribution',$cpan_file);
449 7 $pack->called_for($self->id);
450 7 ▶ if (exists $self->{force_update}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"force_update"}) 0 7 7
451 0 ▶ if ($self->{force_update} == 2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'force_update'} == 2) { } 0 0 0
452 0 $pack->fforce($meth);
453 } else {
454 0 $pack->force($meth);
455 }
456 }
457 7 ▶ $pack->notest($meth) if exists $self->{notest} && $self->{notest};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"notest"} and $self->{"notest"} 0 7 7
Condition33%1/3
exists $self->{"notest"} and $self->{"notest"}
!ll&&!rl&&r
700
MC/DC0%0/2
exists $self->{"notest"} and $self->{"notest"}
exists $self->{"notest"} $self->{"notest"}
Truth table33%1/3
A and B
A= exists $self->{"notest"}B= $self->{"notest"}
ABresult
0X0
100
111
458  
459 7 ▶ $pack->{reqtype} ||= "";
Condition50%1/2
$pack->{"reqtype"} ||= ""
l!l
07
MC/DC0%0/1
$pack->{"reqtype"} ||= ""
$pack->{"reqtype"}
Truth table50%1/2
A
A= $pack->{"reqtype"}
Aresult
11
00
460 7 ▶ CPAN->debug("dist-reqtype[$pack->{reqtype}]".
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 7 7
461 "self-reqtype[$self->{reqtype}]") if $CPAN::DEBUG;
462 7 ▶ if ($pack->{reqtype}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pack->{'reqtype'}) { } 0 7 7
463 0 ▶ if ($pack->{reqtype} eq "b" && $self->{reqtype} =~ /^[rc]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pack->{"reqtype"} eq "b" and $self->{"reqtype"} =~ /^[rc]$/) 0 0 0
Condition0%0/3
$pack->{"reqtype"} eq "b" and $self->{"reqtype"} =~ /^[rc]$/
!ll&&!rl&&r
000
MC/DC0%0/2
$pack->{"reqtype"} eq "b" and $self->{"reqtype"} =~ /^[rc]$/
$pack->{"reqtype"} eq "b" $self->{"reqtype"} =~ /^[rc]$/
Truth table0%0/3
A and B
A= $pack->{"reqtype"} eq "b"B= $self->{"reqtype"} =~ /^[rc]$/
ABresult
0X0
100
111
464 0 $pack->{reqtype} = $self->{reqtype};
465 0 ▶ if (
Branch: 2 branches
BranchTrueFalseTotal
if (exists $pack->{"install"} and UNIVERSAL::can($pack->{"install"}, "failed") ? $pack->{"install"}->failed : $pack->{"install"} =~ /^NO/) 0 0 0
UNIVERSAL::can($pack->{'install'}, 'failed') ? : 0 0 0
Condition0%0/3
exists $pack->{"install"} and UNIVERSAL::can($pack->{"install"}, "failed") ? $pack->{"install"}->failed : $pack->{"install"} =~ /^NO/
!ll&&!rl&&r
000
MC/DC0%0/2
exists $pack->{"install"} and UNIVERSAL::can($pack->{"install"}, "failed") ? $pack->{"install"}->failed : $pack->{"install"} =~ /^NO/
exists $pack->{"install"} UNIVERSAL::can($pack->{"install"}, "failed") ? $pack->{"install"}->failed : $pack->{"install"} =~ /^NO/
Truth table0%0/3
A and B
A= exists $pack->{"install"}B= UNIVERSAL::can($pack->{"install"}, "failed") ? $pack->{"install"}->failed : $pack->{"install"} =~ /^NO/
ABresult
0X0
100
111
466 exists $pack->{install}
467 &&
468 (
469 UNIVERSAL::can($pack->{install},"failed") ?
470 $pack->{install}->failed :
471 $pack->{install} =~ /^NO/
472 )
473 ) {
474 0 delete $pack->{install};
475 0 $CPAN::Frontend->mywarn
476 ("Promoting $pack->{ID} from 'build_requires' to 'requires'");
477 }
478 }
479 } else {
480 7 $pack->{reqtype} = $self->{reqtype};
481 }
482  
483 7 my $success = eval {
484 7 $pack->$meth();
485 };
486 5 my $err = $@;
487 5 ▶ $pack->unforce if $pack->can("unforce") && exists $self->{force_update};
Branch: 1 branch
BranchTrueFalseTotal
if $pack->can("unforce") and exists $self->{"force_update"} 0 5 5
Condition33%1/3
$pack->can("unforce") and exists $self->{"force_update"}
!ll&&!rl&&r
050
MC/DC0%0/2
$pack->can("unforce") and exists $self->{"force_update"}
$pack->can("unforce") exists $self->{"force_update"}
Truth table33%1/3
A and B
A= $pack->can("unforce")B= exists $self->{"force_update"}
ABresult
0X0
100
111
488 5 ▶ $pack->unnotest if $pack->can("unnotest") && exists $self->{notest};
Branch: 1 branch
BranchTrueFalseTotal
if $pack->can("unnotest") and exists $self->{"notest"} 0 5 5
Condition33%1/3
$pack->can("unnotest") and exists $self->{"notest"}
!ll&&!rl&&r
050
MC/DC0%0/2
$pack->can("unnotest") and exists $self->{"notest"}
$pack->can("unnotest") exists $self->{"notest"}
Truth table33%1/3
A and B
A= $pack->can("unnotest")B= exists $self->{"notest"}
ABresult
0X0
100
111
489 5 delete $self->{force_update};
490 5 delete $self->{notest};
491 5 ▶ if ($err) {
Branch: 1 branch
BranchTrueFalseTotal
if ($err) 0 5 5
492 0 die $err;
493 }
494 5 return $success;
495 }
496  
497 #-> sub CPAN::Module::perldoc ;
498 0 ▶sub perldoc { shift->rematein('perldoc') }
Subroutine perldoc: not called CC=1 SCAR=6.9
Pod undocumented
499 #-> sub CPAN::Module::readme ;
500 0 ▶sub readme { shift->rematein('readme') }
Subroutine readme: not called CC=1 SCAR=6.9
Pod undocumented
501 #-> sub CPAN::Module::look ;
502 0 ▶sub look { shift->rematein('look') }
Subroutine look: not called CC=1 SCAR=6.9
Pod undocumented
503 #-> sub CPAN::Module::cvs_import ;
504 0 ▶sub cvs_import { shift->rematein('cvs_import') }
Subroutine cvs_import: not called CC=1 SCAR=6.9
Pod undocumented
505 #-> sub CPAN::Module::get ;
506 0 ▶sub get { shift->rematein('get',@_) }
Subroutine get: not called CC=1 SCAR=6.9
Pod undocumented
507 #-> sub CPAN::Module::make ;
508 0 ▶sub make { shift->rematein('make') }
Subroutine make: not called CC=1 SCAR=6.9
Pod undocumented
509 #-> sub CPAN::Module::test ;
510 sub test {
511 0 ▶ my $self = shift;
Subroutine test: not called CC=1 SCAR=6.9
Pod undocumented
512 # $self->{badtestcnt} ||= 0;
513 0 $self->rematein('test',@_);
514 }
515  
516 #-> sub CPAN::Module::deprecated_in_core ;
517 sub deprecated_in_core {
518 9 ▶ my ($self) = @_;
Subroutine deprecated_in_core: called CC=3 SCAR=12.5
Pod undocumented
519 9 ▶ return unless $CPAN::META->has_inst('Module::CoreList') && Module::CoreList->can('is_deprecated');
Branch: 1 branch
BranchTrueFalseTotal
unless $CPAN::META->has_inst("Module::CoreList") and "Module::CoreList"->can("is_deprecated") 0 9 9
Condition33%1/3
$CPAN::META->has_inst("Module::CoreList") and "Module::CoreList"->can("is_deprecated")
!ll&&!rl&&r
009
MC/DC0%0/2
$CPAN::META->has_inst("Module::CoreList") and "Module::CoreList"->can("is_deprecated")
$CPAN::META->has_inst("Module::CoreList") "Module::CoreList"->can("is_deprecated")
Truth table33%1/3
A and B
A= $CPAN::META->has_inst("Module::CoreList")B= "Module::CoreList"->can("is_deprecated")
ABresult
0X0
100
111
520 9 return Module::CoreList::is_deprecated($self->{ID});
521 }
522  
523 #-> sub CPAN::Module::inst_deprecated;
524 # Indicates whether the *installed* version of the module is a deprecated *and*
525 # installed as part of the Perl core library path
526 sub inst_deprecated {
527 9 ▶ my ($self) = @_;
Subroutine inst_deprecated: called CC=3 SCAR=12.5
Pod undocumented
528 9 ▶ my $inst_file = $self->inst_file or return;
Branch: 1 branch
BranchTrueFalseTotal
my $inst_file = $self->inst_file or return 0 9 9
529 9 ▶ return $self->deprecated_in_core && $self->_in_priv_or_arch($inst_file);
Condition33%1/3
$self->deprecated_in_core && $self->_in_priv_or_arch($inst_file)
!ll&&!rl&&r
900
MC/DC0%0/2
$self->deprecated_in_core && $self->_in_priv_or_arch($inst_file)
$self->deprecated_in_core $self->_in_priv_or_arch($inst_file)
Truth table33%1/3
A && B
A= $self->deprecated_in_coreB= $self->_in_priv_or_arch($inst_file)
ABresult
0X0
100
111
530 }
531  
532 #-> sub CPAN::Module::uptodate ;
533 sub uptodate {
534 23 ▶ my ($self) = @_;
Subroutine uptodate: called CC=5 SCAR=16.8
Pod undocumented
535 23 local ($_);
536 23 ▶ my $inst = $self->inst_version or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $inst = $self->inst_version or return 0 14 9 23
537 9 my $cpan = $self->cpan_version;
538 9 ▶ return 0 if CPAN::Version->vgt($cpan,$inst) || $self->inst_deprecated;
Branch: 1 branch
BranchTrueFalseTotal
if "CPAN::Version"->vgt($cpan, $inst) or $self->inst_deprecated 0 9 9
Condition33%1/3
"CPAN::Version"->vgt($cpan, $inst) or $self->inst_deprecated
l!l&&r!l&&!r
009
MC/DC0%0/2
"CPAN::Version"->vgt($cpan, $inst) or $self->inst_deprecated
"CPAN::Version"->vgt($cpan, $inst) $self->inst_deprecated
Truth table33%1/3
A or B
A= "CPAN::Version"->vgt($cpan, $inst)B= $self->inst_deprecated
ABresult
1X1
011
000
539 9 ▶ CPAN->debug
Branch: 1 branch
BranchTrueFalseTotal
if $CPAN::DEBUG 0 9 9
540 (join
541 ("",
542 "returning uptodate. ",
543 "cpan[$cpan]inst[$inst]",
544 )) if $CPAN::DEBUG;
545 9 return 1;
546 }
547  
548 # returns true if installed in privlib or archlib
549 sub _in_priv_or_arch {
550 0 ▶ my($self,$inst_file) = @_;
Subroutine _in_priv_or_arch: not called CC=7 SCAR=40.3
551 0 foreach my $pair (
552 [qw(sitearchexp archlibexp)],
553 [qw(sitelibexp privlibexp)]
554 ) {
555 0 my ($site, $priv) = @Config::Config{@$pair};
556 0 ▶ if ($^O eq 'VMS') {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq "VMS") 0 0 0
557 0 for my $d ($site, $priv) { $d = VMS::Filespec::unixify($d) };
558 }
559 0 s!/*$!!g foreach $site, $priv;
560 0 ▶ next if $site eq $priv;
Branch: 1 branch
BranchTrueFalseTotal
if $site eq $priv 0 0 0
561  
562 0 ▶ if ($priv eq substr($inst_file,0,length($priv))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($priv eq substr($inst_file, 0, length $priv)) 0 0 0
563 0 return 1;
564 }
565 }
566 0 return 0;
567 }
568  
569 #-> sub CPAN::Module::install ;
570 sub install {
571 7 ▶ my($self) = @_;
Subroutine install: called CC=7 SCAR=25.2
Pod undocumented
572 7 my($doit) = 0;
573 7 ▶ if ($self->uptodate
Branch: 1 branch
BranchTrueFalseTotal
if ($self->uptodate and not exists $self->{'force_update'}) { } 0 7 7
Condition33%1/3
$self->uptodate and not exists $self->{"force_update"}
!ll&&!rl&&r
700
MC/DC0%0/2
$self->uptodate and not exists $self->{"force_update"}
$self->uptodate not exists $self->{"force_update"}
Truth table33%1/3
A and not(B)
A= $self->uptodateB= not exists $self->{"force_update"}
ABresult
0X0
100
111
574 &&
575 not exists $self->{force_update}
576 ) {
577 0 $CPAN::Frontend->myprint(sprintf("%s is up to date (%s).\n",
578 $self->id,
579 $self->inst_version,
580 ));
581 } else {
582 7 $doit = 1;
583 }
584 7 my $ro = $self->ro;
585 7 ▶ if ($ro && $ro->{stats} && $ro->{stats} eq "a") {
Branch: 1 branch
BranchTrueFalseTotal
if ($ro and $ro->{"stats"} and $ro->{"stats"} eq "a") 0 7 7
Condition33%2/6
$ro and $ro->{"stats"} and $ro->{"stats"} eq "a"
!ll&&!rl&&r
700
$ro and $ro->{"stats"}
!ll&&!rl&&r
070
MC/DC0%0/3
$ro and $ro->{"stats"} and $ro->{"stats"} eq "a"
$ro $ro->{"stats"} $ro->{"stats"} eq "a"
Truth table25%1/4
A and B and C
A= $roB= $ro->{"stats"}C= $ro->{"stats"} eq "a"
ABCresult
0XX0
10X0
1100
1111
586 0 $CPAN::Frontend->mywarn(qq{
587 \n\n\n ***WARNING***
588 The module $self->{ID} has no active maintainer (CPAN support level flag 'abandoned').\n\n\n
589 });
590 0 $CPAN::Frontend->mysleep(5);
591 }
592 7 ▶ return $doit ? $self->rematein('install') : 1;
Branch: 1 branch
BranchTrueFalseTotal
$doit ? : 7 0 7
593 }
594 #-> sub CPAN::Module::clean ;
595 0 ▶sub clean { shift->rematein('clean') }
Subroutine clean: not called CC=1 SCAR=6.9
Pod undocumented
596  
597 #-> sub CPAN::Module::inst_file ;
598 sub inst_file {
599 40 ▶ my($self) = @_;
Subroutine inst_file: called CC=1 SCAR=0.0
Pod undocumented
600 40 $self->_file_in_path([@INC]);
601 }
602  
603 #-> sub CPAN::Module::available_file ;
604 sub available_file {
605 23 ▶ my($self) = @_;
Subroutine available_file: called CC=5 SCAR=19.3
Pod undocumented
606 23 my $sep = $Config::Config{path_sep};
607 23 my $perllib = $ENV{PERL5LIB};
608 23 ▶ $perllib = $ENV{PERLLIB} unless defined $perllib;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $perllib 0 23 23
609 23 ▶ my @perllib = split(/$sep/,$perllib) if defined $perllib;
Branch: 1 branch
BranchTrueFalseTotal
if defined $perllib 23 0 23
610 23 my @cpan_perl5inc;
611 23 ▶ if ($CPAN::Perl5lib_tempfile) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CPAN::Perl5lib_tempfile) 0 23 23
612 0 my $yaml = CPAN->_yaml_loadfile($CPAN::Perl5lib_tempfile);
613 0 ▶ @cpan_perl5inc = @{$yaml->[0]{inc} || []};
Branch: 1 branch
BranchTrueFalseTotal
$yaml->[0]{"inc"} or [] 0 0 0
614 }
615 23 $self->_file_in_path([@cpan_perl5inc,@perllib,@INC]);
616 }
617  
618 #-> sub CPAN::Module::file_in_path ;
619 sub _file_in_path {
620 63 ▶ my($self,$path) = @_;
Subroutine _file_in_path: called CC=5 SCAR=16.3
621 63 my($dir,@packpath);
622 63 @packpath = split /::/, $self->{ID};
623 63 $packpath[-1] .= ".pm";
624 63 ▶ if (@packpath == 1 && $packpath[0] eq "readline.pm") {
Branch: 1 branch
BranchTrueFalseTotal
if (@packpath == 1 and $packpath[0] eq "readline.pm") 0 63 63
Condition66%2/3
@packpath == 1 and $packpath[0] eq "readline.pm"
!ll&&!rl&&r
6120
MC/DC0%0/2
@packpath == 1 and $packpath[0] eq "readline.pm"
@packpath == 1 $packpath[0] eq "readline.pm"
Truth table66%2/3
A and B
A= @packpath == 1B= $packpath[0] eq "readline.pm"
ABresult
0X0
100
111
625 0 unshift @packpath, "Term", "ReadLine"; # historical reasons
626 }
627 63 foreach $dir (@$path) {
628 647 my $pmfile = File::Spec->catfile($dir,@packpath);
629 647 ▶ if (-f $pmfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $pmfile) 42 605 647
630 42 return $pmfile;
631 }
632 }
633 21 return;
634 }
635  
636 #-> sub CPAN::Module::xs_file ;
637 sub xs_file {
638 0 ▶ my($self) = @_;
Subroutine xs_file: not called CC=3 SCAR=24.8
Pod undocumented
639 0 my($dir,@packpath);
640 0 @packpath = split /::/, $self->{ID};
641 0 push @packpath, $packpath[-1];
642 0 $packpath[-1] .= "." . $Config::Config{'dlext'};
643 0 foreach $dir (@INC) {
644 0 my $xsfile = File::Spec->catfile($dir,'auto',@packpath);
645 0 ▶ if (-f $xsfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $xsfile) 0 0 0
646 0 return $xsfile;
647 }
648 }
649 0 return;
650 }
651  
652 #-> sub CPAN::Module::inst_version ;
653 sub inst_version {
654 23 ▶ my($self) = @_;
Subroutine inst_version: called CC=2 SCAR=6.9
Pod undocumented
655 23 ▶ my $parsefile = $self->inst_file or return;
Branch: 1 branch
BranchTrueFalseTotal
my $parsefile = $self->inst_file or return 14 9 23
656 9 my $have = $self->parse_version($parsefile);
657 9 $have;
658 }
659  
660 #-> sub CPAN::Module::inst_version ;
661 sub available_version {
662 15 ▶ my($self) = @_;
Subroutine available_version: called CC=2 SCAR=6.9
Pod undocumented
663 15 ▶ my $parsefile = $self->available_file or return;
Branch: 1 branch
BranchTrueFalseTotal
my $parsefile = $self->available_file or return 7 8 15
664 8 my $have = $self->parse_version($parsefile);
665 8 $have;
666 }
667  
668 #-> sub CPAN::Module::parse_version ;
669 sub parse_version {
670 17 ▶ my($self,$parsefile) = @_;
Subroutine parse_version: called CC=7 SCAR=20.6
Pod undocumented
671 17 ▶ if (ALARM_IMPLEMENTED) {
Branch: 1 branch
BranchTrueFalseTotal
if (&ALARM_IMPLEMENTED()) 17 0 17
672 my $timeout = (exists($CPAN::Config{'version_timeout'}))
673 17 ▶ ? $CPAN::Config{'version_timeout'}
Branch: 1 branch
BranchTrueFalseTotal
exists $CPAN::Config{'version_timeout'} ? : 0 17 17
674 : 15;
675 17 alarm($timeout);
676 }
677 17 my $have = eval {
678 17 ▶ local $SIG{ALRM} = sub { die "alarm\n" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
679 17 MM->parse_version($parsefile);
680 };
681 17 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 17 17
682 0 $CPAN::Frontend->mywarn("Error while parsing version number in file '$parsefile'\n");
683 }
684 17 ▶ alarm(0) if ALARM_IMPLEMENTED;
Branch: 1 branch
BranchTrueFalseTotal
if &ALARM_IMPLEMENTED() 17 0 17
685 17 ▶ my $leastsanity = eval { defined $have && length $have; };
Branch: 1 branch
BranchTrueFalseTotal
defined $have and length $have 17 0 17
686 17 ▶ $have = "undef" unless $leastsanity;
Branch: 1 branch
BranchTrueFalseTotal
unless $leastsanity 0 17 17
687 17 $have =~ s/^ //; # since the %vd hack these two lines here are needed
688 17 $have =~ s/ $//; # trailing whitespace happens all the time
689  
690 17 $have = CPAN::Version->readable($have);
691  
692 17 $have =~ s/\s*//g; # stringify to float around floating point issues
693 17 $have; # no stringify needed, \s* above matches always
694 }
695  
696 #-> sub CPAN::Module::reports
697 sub reports {
698 0 ▶ my($self) = @_;
Subroutine reports: not called CC=1 SCAR=6.9
Pod undocumented
699 0 $self->distribution->reports;
700 }
701  
702 24 1;
« blib/lib/CPAN/Tarzip.pm ↑ Summary blib/lib/CPAN/Mirrors.pm »