| 1 | package CPAN::Maker::Role::Provides; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use English qw(-no_match_vars); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use File::Find; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use File::Process qw(process_file); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Scalar::Util qw(reftype); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use CLI::Simple::Utils qw(slurp); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use CLI::Simple::Constants qw(:booleans); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Role::Tiny; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | requires qw(get_module_version); | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | sub create_provides { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_provides: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | my $path = $args{path} // 'lib'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"path"} // "lib"
MC/DC0%0/1
$args{"path"} // "lib"
$args{"path"}
Truth table0%0/2
A
A= $args{"path"}
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | my $file = $args{file} // 'provides'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"file"} // "provides"
MC/DC0%0/1
$args{"file"} // "provides"
$args{"file"}
Truth table0%0/2
A
A= $args{"file"}
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my @provides; | |||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | if ( -d $path ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | find( | ||||||||||||||||||||||||||||||||||||||||||
| 31 | { follow => $TRUE, | ||||||||||||||||||||||||||||||||||||||||||
| 32 | no_chdir => $TRUE, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | wanted => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $module_file = $File::Find::name; | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | return if !-f $module_file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | return if $module_file !~ /[.]pm$/xsm; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $module = $module_file; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | $module =~ s{^\Q$path\E/?}{}xsm; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $module =~ s{/}{::}gxsm; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | $module =~ s{[.]pm$}{}xsm; | |||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my $module_version = $self->get_module_version( $module, $path ); | |||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | my $provided_module = $module_version->{module} // $module; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$module_version->{"module"} // $module
MC/DC0%0/2
$module_version->{"module"} // $module
$module_version->{"module"}
$module
Truth table0%0/3
A // B
A= $module_version->{"module"}B= $module
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my $version = $module_version->{version} // 'undef'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$module_version->{"version"} // "undef"
MC/DC0%0/1
$module_version->{"version"} // "undef"
$module_version->{"version"}
Truth table0%0/2
A
A= $module_version->{"version"}
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | push @provides, sprintf '%s %s', $provided_module, $version; | |||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 53 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 54 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | $path | |||||||||||||||||||||||||||||||||||||||||
| 56 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | $self->write_provides( | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | provides => \@provides, | |||||||||||||||||||||||||||||||||||||||||
| 61 | file => $file, | ||||||||||||||||||||||||||||||||||||||||||
| 62 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | return $file; | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | sub get_provides { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_provides: not called CC=14 SCAR=52.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | my $file = $args{file}; | |||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my $work_dir = $args{work_dir}; | |||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | my %provides; | |||||||||||||||||||||||||||||||||||||||||
| 76 | my @missing; | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | return %provides | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$file and -e $file
MC/DC0%0/2
$file and -e $file
$file
-e $file
Truth table0%0/3
A and B
A= $fileB= -e $file
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | if !$file || !-e $file; | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | process_file( | ||||||||||||||||||||||||||||||||||||||||||
| 82 | $file, | ||||||||||||||||||||||||||||||||||||||||||
| 83 | chomp => $TRUE, | ||||||||||||||||||||||||||||||||||||||||||
| 84 | skip_blank_lines => $TRUE, | ||||||||||||||||||||||||||||||||||||||||||
| 85 | prefix => 'lib', | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | process => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my $line = pop @_; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my $args = pop @_; | |||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | return () | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | if !$line; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my ( $module, $provided_version ) = split /\s+/xsm, $line, 2; | |||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | return () | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if !$module; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | $provided_version //= 'undef'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$provided_version //= "undef"
MC/DC0%0/1
$provided_version //= "undef"
$provided_version
Truth table0%0/2
A
A= $provided_version
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my $prefix = $args->{prefix}; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my $include_path = $prefix; | |||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | if ($work_dir) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | $include_path = sprintf '%s/%s', $work_dir, $prefix; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | my $module_version = $self->get_module_version( $module, $include_path ); | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | my $provided_module = $module_version->{module} // $module; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$module_version->{"module"} // $module
MC/DC0%0/2
$module_version->{"module"} // $module
$module_version->{"module"}
$module
Truth table0%0/3
A // B
A= $module_version->{"module"}B= $module
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | if ( !$module_version->{file} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | push @missing, | |||||||||||||||||||||||||||||||||||||||||
| 113 | { | ||||||||||||||||||||||||||||||||||||||||||
| 114 | module => $module, | ||||||||||||||||||||||||||||||||||||||||||
| 115 | version => $provided_version, | ||||||||||||||||||||||||||||||||||||||||||
| 116 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | return $provided_module; | |||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | $provides{$provided_module} = { | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | file => sprintf( '%s/%s', $prefix, $module_version->{file}, ), | |||||||||||||||||||||||||||||||||||||||||
| 123 | version => $provided_version, | ||||||||||||||||||||||||||||||||||||||||||
| 124 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | return $provided_module; | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | if (@missing) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | my $dir = $work_dir ? sprintf( '%s/lib', $work_dir ) : 'lib'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my @file_list; | |||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if ( -d $dir ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | find( | ||||||||||||||||||||||||||||||||||||||||||
| 137 | { no_chdir => $TRUE, | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | wanted => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | my $module_file = $File::Find::name; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | return if !-f $module_file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | return if $module_file !~ /[.]pm$/xsm; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | push @file_list, $module_file; | |||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 145 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 146 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $dir | |||||||||||||||||||||||||||||||||||||||||
| 148 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | local @INC = ( $dir, @INC ); | |||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | foreach my $missing (@missing) { | |||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $module = $missing->{module}; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my $provided_version = $missing->{version}; | |||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | foreach my $module_file (@file_list) { | |||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my $text = slurp($module_file); | |||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | next | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if $text !~ /^package\s+\Q$module\E;/xsm; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | # Remove POD before confirming the package declaration so a | ||||||||||||||||||||||||||||||||||||||||||
| 164 | # documented package name does not produce a false positive. | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $text =~ s/^=pod(.*?)=cut//xsmg; | |||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | next | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if $text !~ /^package\s+\Q$module\E;/xsm; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my $version = $provided_version; | |||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | if ( !defined $version || $version eq 'undef' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $version or $version eq "undef"
MC/DC0%0/2
not defined $version or $version eq "undef"
not defined $version
$version eq "undef"
Truth table0%0/3
not(A) or B
A= not defined $versionB= $version eq "undef"
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $version = eval { | |||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | local $SIG{__WARN__} = sub { }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | require $module_file; | |||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | ▶ | no strict 'refs'; ## no critic | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | return ${ $module . '::VERSION' }; | |||||||||||||||||||||||||||||||||||||||||
| 181 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | $version //= 'undef'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$version //= "undef"
MC/DC0%0/1
$version //= "undef"
$version
Truth table0%0/2
A
A= $version
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my $rel_path = $module_file; | |||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if ($work_dir) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $rel_path =~ s{^\Q$work_dir\E/}{}xsm; | |||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $provides{$module} = { | |||||||||||||||||||||||||||||||||||||||||
| 193 | file => $rel_path, | ||||||||||||||||||||||||||||||||||||||||||
| 194 | version => $version, | ||||||||||||||||||||||||||||||||||||||||||
| 195 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | return %provides; | |||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | sub _write_provides { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_write_provides: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my ( $self, $fh, $provides ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | croak "provides must be an array\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not defined $provides && ref $provides or builtin::reftype($provides) ne "ARRAY"
defined $provides && ref $provides
MC/DC0%0/3
not defined $provides && ref $provides or builtin::reftype($provides) ne "ARRAY"
defined $provides
ref $provides
builtin::reftype($provides) ne "ARRAY"
Truth table0%0/4
not(A && B) or C
A= defined $providesB= ref $providesC= builtin::reftype($provides) ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | if !defined $provides || !ref $provides || reftype($provides) ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | foreach my $provide ( sort @{$provides} ) { | |||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | next if !$provide; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | my ( $module, $version ) = split /\s+/xsm, $provide, 2; | |||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | if ( !defined $version || $version eq q{} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $version or $version eq ""
MC/DC0%0/2
not defined $version or $version eq ""
not defined $version
$version eq ""
Truth table0%0/3
not(A) or B
A= not defined $versionB= $version eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $version = 'undef'; | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | print {$fh} sprintf "%s %s\n", $module, $version; | |||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | sub write_provides { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_provides: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $provides = $args{provides}; | |||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | my $file = $args{file} // 'provides'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args{"file"} // "provides"
MC/DC0%0/1
$args{"file"} // "provides"
$args{"file"}
Truth table0%0/2
A
A= $args{"file"}
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | return | ||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if !$provides; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | croak "provides must be an array\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not ref $provides or builtin::reftype($provides) ne "ARRAY"
MC/DC0%0/2
not ref $provides or builtin::reftype($provides) ne "ARRAY"
not ref $provides
builtin::reftype($provides) ne "ARRAY"
Truth table0%0/3
not(A) or B
A= not ref $providesB= builtin::reftype($provides) ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | if !ref $provides || reftype($provides) ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | open my $fh, '>', $file | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | or croak "could not open '$file' for writing: $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $self->_write_provides( $fh, $provides ); | |||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | close $fh | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | or croak "could not close '$file': $OS_ERROR\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||