blib/lib/ExtUtils/InstallPaths.pm

filter: Statementstmt 77.1% 159 / 206 Branchbran 51.0% 49 / 96 Conditioncond 26.9% 7 / 26 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 91.1% 31 / 34 Podpod 100% 6 / 6 totaltotal 65.6% 252 / 384 CC 60 SCAR 27.8
CC
60
Cov
66%
_prefixify_vms
90.0
install_map
23.6
is_default_installable
20.0
CRAP 16.1
↑ Summary
1 package ExtUtils::InstallPaths;
2 2 $ExtUtils::InstallPaths::VERSION = '0.011';
3 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use File::Spec ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use ExtUtils::Config 0.002;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 my %complex_accessors = map { $_ => 1 } qw/prefix_relpaths install_sets/;
12 2 my %hash_accessors = map { $_ => 1 } qw/install_path install_base_relpaths original_prefix /;
13  
14 my %defaults = (
15 installdirs => 'site',
16 install_base => undef,
17 prefix => undef,
18 verbose => 0,
19 blib => 'blib',
20 create_packlist => 1,
21 dist_name => undef,
22 module_name => undef,
23 destdir => undef,
24 11 ▶ install_path => sub { {} },
Subroutine __ANON__: called CC=1 SCAR=0.0
25 2 install_sets => \&_default_install_sets,
26 original_prefix => \&_default_original_prefix,
27 install_base_relpaths => \&_default_base_relpaths,
28 prefix_relpaths => \&_default_prefix_relpaths,
29 );
30  
31 sub _merge_shallow {
32 4 ▶ my ($name, $filter) = @_;
Subroutine _merge_shallow: called CC=1 SCAR=0.0
33 return sub {
34 1 ▶ my ($override, $config) = @_;
Subroutine __ANON__: called CC=2 SCAR=6.9
35 1 my $defaults = $defaults{$name}->($config);
36 1 $filter->($_) for grep $filter, values %$override;
37 1 return { %$defaults, %$override };
38 }
39 4 }
40  
41 sub _merge_deep {
42 4 ▶ my ($name, $filter) = @_;
Subroutine _merge_deep: called CC=1 SCAR=0.0
43 return sub {
44 3 ▶ my ($override, $config) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
45 3 my $defaults = $defaults{$name}->($config);
46 my $pair_for = sub {
47 9 ▶ my $key = shift;
Subroutine __ANON__: called CC=4 SCAR=13.9
48 9 ▶ my %override = %{ $override->{$key} || {} };
Branch: 1 branch
BranchTrueFalseTotal
$override->{$key} or {} 6 3 9
49 9 ▶ $filter && $filter->($_) for values %override;
Branch: 1 branch
BranchTrueFalseTotal
$filter and &$filter($_) 2 8 10
50 8 return $key => { %{ $defaults->{$key} }, %override };
51 3 };
52 3 return { map { $pair_for->($_) } keys %$defaults };
53 }
54 4 }
55  
56 2 my %allowed_installdir = map { $_ => 1 } qw/core site vendor/;
57 3 ▶my $must_be_relative = sub { Carp::croak('Value must be a relative path') if File::Spec->file_name_is_absolute($_[0]) };
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if "File::Spec"->file_name_is_absolute($_[0]) 1 2 3
58 2 my %deep_filter = map { $_ => $must_be_relative } qw/install_base_relpaths prefix_relpaths/;
59 my %filter = (
60 installdirs => sub {
61 13 ▶ my $value = shift;
Subroutine __ANON__: called CC=3 SCAR=11.4
62 13 ▶ $value = 'core', Carp::carp('Perhaps you meant installdirs to be "core" rather than "perl"?') if $value eq 'perl';
Branch: 1 branch
BranchTrueFalseTotal
if $value eq "perl" 0 13 13
63 13 ▶ Carp::croak('installdirs must be one of "core", "site", or "vendor"') if not $allowed_installdir{$value};
Branch: 1 branch
BranchTrueFalseTotal
unless $allowed_installdir{$value} 0 13 13
64 13 return $value;
65 },
66 4 (map { $_ => _merge_shallow($_, $deep_filter{$_}) } qw/original_prefix install_base_relpaths/),
67 2 (map { $_ => _merge_deep($_, $deep_filter{$_}) } qw/install_sets prefix_relpaths/),
68 );
69  
70 sub new {
71 13 ▶ my ($class, %args) = @_;
Subroutine new: called CC=7 SCAR=20.2
Pod documented
72 13 ▶ my $config = $args{config} || ExtUtils::Config->new;
Condition33%1/3
$args{'config'} || 'ExtUtils::Config'->new
l!l&&r!l&&!r
1300
MC/DC0%0/2
$args{'config'} || 'ExtUtils::Config'->new
$args{'config'} 'ExtUtils::Config'->new
Truth table33%1/3
A || B
A= $args{'config'}B= 'ExtUtils::Config'->new
ABresult
1X1
011
000
73 my %self = (
74 config => $config,
75 13 ▶ map { $_ => exists $args{$_} ? $filter{$_} ? $filter{$_}->($args{$_}, $config) : $args{$_} : ref $defaults{$_} ? $defaults{$_}->($config) : $defaults{$_} } keys %defaults,
Branch: 3 branches
BranchTrueFalseTotal
exists $args{$_} ? : 38 143 181
$filter{$_} ? : 17 21 38
ref $defaults{$_} ? : 59 84 143
76 );
77 12 ▶ $self{module_name} ||= do { my $module_name = $self{dist_name}; $module_name =~ s/-/::/g; $module_name } if defined $self{dist_name};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self{"dist_name"} 12 0 12
Condition33%1/3
$self{"module_name"} ||= do { my $module_name = $self{"dist_name"}; $module_name =~ s/-/::/g; $module_name }
l!l&&r!l&&!r
0120
MC/DC0%0/2
$self{"module_name"} ||= do { my $module_name = $self{"dist_name"}; $module_name =~ s/-/::/g; $module_name }
$self{"module_name"} do { my $module_name = $self{"dist_name"}; $module_name =~ s/-/::/g; $module_name }
Truth table33%1/3
A ||= B
A= $self{"module_name"}B= do { my $module_name = $self{"dist_name"}; $module_name =~ s/-/::/g; $module_name }
ABresult
1X1
011
000
78 12 return bless \%self, $class;
79 }
80  
81 2 for my $attribute (keys %defaults) {
82 2 ▶ no strict qw/refs/;
Subroutine BEGIN: called CC=1 SCAR=0.0
83 28 *{$attribute} = $hash_accessors{$attribute} ?
84 sub {
85 118 ▶ my ($self, $key) = @_;
Subroutine __ANON__: called CC=2 SCAR=7.1
86 118 ▶ Carp::confess("$attribute needs key") if not defined $key;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key 0 118 118
87 118 return $self->{$attribute}{$key};
88 } :
89 $complex_accessors{$attribute} ?
90 sub {
91 79 ▶ my ($self, $installdirs, $key) = @_;
Subroutine __ANON__: called CC=3 SCAR=11.4
92 79 ▶ Carp::confess("$attribute needs installdir") if not defined $installdirs;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $installdirs 0 79 79
93 79 ▶ Carp::confess("$attribute needs key") if not defined $key;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key 0 79 79
94 79 return $self->{$attribute}{$installdirs}{$key};
95 } :
96 sub {
97 325 ▶ my $self = shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
98 325 return $self->{$attribute};
99 28 ▶ };
Branch: 2 branches
BranchTrueFalseTotal
$hash_accessors{$attribute} ? : 6 22 28
$complex_accessors{$attribute} ? : 4 18 22
100 }
101  
102 2 ▶my $script = $] > 5.008000 ? 'script' : 'bin';
Branch: 1 branch
BranchTrueFalseTotal
$] > 5.008 ? : 2 0 2
103 2 my @install_sets_keys = qw/lib arch bin script bindoc libdoc binhtml libhtml/;
104 2 my @install_sets_tail = ('bin', $script, qw/man1dir man3dir html1dir html3dir/);
105 my %install_sets_values = (
106 core => [ qw/privlib archlib /, @install_sets_tail ],
107 16 site => [ map { "site$_" } qw/lib arch/, @install_sets_tail ],
108 2 vendor => [ map { "vendor$_" } qw/lib arch/, @install_sets_tail ],
109 );
110  
111 sub _default_install_sets {
112 13 ▶ my $c = shift;
Subroutine _default_install_sets: called CC=2 SCAR=6.9
113  
114 13 my %ret;
115 13 for my $installdir (qw/core site vendor/) {
116 39 @{$ret{$installdir}}{@install_sets_keys} = map { $c->get("install$_") } @{ $install_sets_values{$installdir} };
117 }
118 13 return \%ret;
119 }
120  
121 sub _default_base_relpaths {
122 13 ▶ my $config = shift;
Subroutine _default_base_relpaths: called CC=1 SCAR=0.0
123 return {
124 13 lib => ['lib', 'perl5'],
125 arch => ['lib', 'perl5', $config->get('archname')],
126 bin => ['bin'],
127 script => ['bin'],
128 bindoc => ['man', 'man1'],
129 libdoc => ['man', 'man3'],
130 binhtml => ['html'],
131 libhtml => ['html'],
132 };
133 }
134  
135 2 my %common_prefix_relpaths = (
136 bin => ['bin'],
137 script => ['bin'],
138 bindoc => ['man', 'man1'],
139 libdoc => ['man', 'man3'],
140 binhtml => ['html'],
141 libhtml => ['html'],
142 );
143  
144 sub _default_prefix_relpaths {
145 13 ▶ my $c = shift;
Subroutine _default_prefix_relpaths: called CC=2 SCAR=7.0
146  
147 13 ▶ my @libstyle = $c->get('installstyle') ? File::Spec->splitdir($c->get('installstyle')) : qw(lib perl5);
Branch: 1 branch
BranchTrueFalseTotal
$c->get('installstyle') ? : 13 0 13
148 13 my $arch = $c->get('archname');
149 13 my $version = $c->get('version');
150  
151 return {
152 13 core => {
153 lib => [@libstyle],
154 arch => [@libstyle, $version, $arch],
155 %common_prefix_relpaths,
156 },
157 vendor => {
158 lib => [@libstyle],
159 arch => [@libstyle, $version, $arch],
160 %common_prefix_relpaths,
161 },
162 site => {
163 lib => [@libstyle, 'site_perl'],
164 arch => [@libstyle, 'site_perl', $version, $arch],
165 %common_prefix_relpaths,
166 },
167 };
168 }
169  
170 sub _default_original_prefix {
171 13 ▶ my $c = shift;
Subroutine _default_original_prefix: called CC=2 SCAR=7.1
172  
173 13 ▶ my %ret = (
Branch: 1 branch
BranchTrueFalseTotal
$c->get('usevendorprefix') ? : 0 13 13
174 core => $c->get('installprefixexp'),
175 site => $c->get('siteprefixexp'),
176 vendor => $c->get('usevendorprefix') ? $c->get('vendorprefixexp') : '',
177 );
178  
179 13 return \%ret;
180 }
181  
182 sub _log_verbose {
183 48 ▶ my $self = shift;
Subroutine _log_verbose: called CC=2 SCAR=7.1
184 48 ▶ print @_ if $self->verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 48 48
185 48 return;
186 }
187  
188 # Given a file type, will return true if the file type would normally
189 # be installed when neither install-base nor prefix has been set.
190 # I.e. it will be true only if the path is set from Config.pm or
191 # set explicitly by the user via install-path.
192 sub is_default_installable {
193 0 ▶ my $self = shift;
Subroutine is_default_installable: not called CC=4 SCAR=30.0
Pod documented
194 0 my $type = shift;
195 0 ▶ my $installable = $self->install_destination($type) && ( $self->install_path($type) || $self->install_sets($self->installdirs, $type));
Condition0%0/6
$self->install_destination($type) && ($self->install_path($type) || $self->install_sets($self->installdirs, $type))
!ll&&!rl&&r
000
$self->install_path($type) or $self->install_sets($self->installdirs, $type)
l!l&&r!l&&!r
000
MC/DC0%0/3
$self->install_destination($type) && ($self->install_path($type) || $self->install_sets($self->installdirs, $type))
$self->install_destination($type) $self->install_path($type) $self->install_sets($self->installdirs, $type)
Truth table0%0/4
A && B or C
A= $self->install_destination($type)B= $self->install_path($type)C= $self->install_sets($self->installdirs, $type)
ABCresult
0XX0
1000
11X1
1011
196 0 ▶ return $installable ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$installable ? : 0 0 0
197 }
198  
199 sub _prefixify_default {
200 24 ▶ my $self = shift;
Subroutine _prefixify_default: called CC=2 SCAR=7.3
201 24 my $type = shift;
202 24 my $rprefix = shift;
203  
204 24 my $default = $self->prefix_relpaths($self->installdirs, $type);
205 24 ▶ if( !$default ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $default) { } 0 24 24
206 0 $self->_log_verbose(" no default install location for type '$type', using prefix '$rprefix'.\n");
207 0 return $rprefix;
208 } else {
209 24 return File::Spec->catdir(@{$default});
210 }
211 }
212  
213 # Translated from ExtUtils::MM_Unix::prefixify()
214 sub _prefixify_novms {
215 24 ▶ my($self, $path, $sprefix, $type) = @_;
Subroutine _prefixify_novms: called CC=8 SCAR=27.7
216  
217 24 my $rprefix = $self->prefix;
218 24 ▶ $rprefix .= '/' if $sprefix =~ m{/$};
Branch: 1 branch
BranchTrueFalseTotal
if $sprefix =~ m[/$] 0 24 24
219  
220 24 ▶ $self->_log_verbose(" prefixify $path from $sprefix to $rprefix\n") if defined $path && length $path;
Branch: 1 branch
BranchTrueFalseTotal
if defined $path and length $path 24 0 24
Condition33%1/3
defined $path and length $path
!ll&&!rl&&r
0024
MC/DC0%0/2
defined $path and length $path
defined $path length $path
Truth table33%1/3
A and B
A= defined $pathB= length $path
ABresult
0X0
100
111
221  
222 24 ▶ if (not defined $path or length $path == 0 ) {
Branch: 3 branches
BranchTrueFalseTotal
if (not defined $path or length $path == 0) { } 0 24 24
elsif (not 'File::Spec'->file_name_is_absolute($path)) { } 0 24 24
elsif (not $path =~ s/^\Q$sprefix\E\b//s) { } 24 0 24
Condition33%1/3
not defined $path or length $path == 0
l!l&&r!l&&!r
0024
MC/DC0%0/2
not defined $path or length $path == 0
not defined $path length $path == 0
Truth table33%1/3
not(A) or B
A= not defined $pathB= length $path == 0
ABresult
1X1
011
000
223 0 $self->_log_verbose(" no path to prefixify, falling back to default.\n");
224 0 return $self->_prefixify_default( $type, $rprefix );
225 } elsif( !File::Spec->file_name_is_absolute($path) ) {
226 0 $self->_log_verbose(" path is relative, not prefixifying.\n");
227 } elsif( $path !~ s{^\Q$sprefix\E\b}{}s ) {
228 24 $self->_log_verbose(" cannot prefixify, falling back to default.\n");
229 24 return $self->_prefixify_default( $type, $rprefix );
230 }
231  
232 0 $self->_log_verbose(" now $path in $rprefix\n");
233  
234 0 return $path;
235 }
236  
237 sub _catprefix_vms {
238 0 ▶ my ($self, $rprefix, $default) = @_;
Subroutine _catprefix_vms: not called CC=2 SCAR=17.9
239  
240 0 my ($rvol, $rdirs) = File::Spec->splitpath($rprefix);
241 0 ▶ if ($rvol) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rvol) { } 0 0 0
242 0 return File::Spec->catpath($rvol, File::Spec->catdir($rdirs, $default), '');
243 }
244 else {
245 0 return File::Spec->catdir($rdirs, $default);
246 }
247 }
248 sub _prefixify_vms {
249 0 ▶ my($self, $path, $sprefix, $type) = @_;
Subroutine _prefixify_vms: not called CC=9 SCAR=45.0
250 0 my $rprefix = $self->prefix;
251  
252 0 ▶ return '' unless defined $path;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $path 0 0 0
253  
254 0 $self->_log_verbose(" prefixify $path from $sprefix to $rprefix\n");
255  
256 0 require VMS::Filespec;
257 # Translate $(PERLPREFIX) to a real path.
258 0 ▶ $rprefix = VMS::Filespec::vmspath($rprefix) if $rprefix;
Branch: 1 branch
BranchTrueFalseTotal
if $rprefix 0 0 0
259 0 ▶ $sprefix = VMS::Filespec::vmspath($sprefix) if $sprefix;
Branch: 1 branch
BranchTrueFalseTotal
if $sprefix 0 0 0
260  
261 0 $self->_log_verbose(" rprefix translated to $rprefix\n sprefix translated to $sprefix\n");
262  
263 0 ▶ if (length($path) == 0 ) {
Branch: 3 branches
BranchTrueFalseTotal
if (length $path == 0) { } 0 0 0
elsif (not 'File::Spec'->file_name_is_absolute($path)) { } 0 0 0
elsif ($sprefix eq $rprefix) { } 0 0 0
264 0 $self->_log_verbose(" no path to prefixify.\n")
265 }
266 elsif (!File::Spec->file_name_is_absolute($path)) {
267 0 $self->_log_verbose(" path is relative, not prefixifying.\n");
268 }
269 elsif ($sprefix eq $rprefix) {
270 0 $self->_log_verbose(" no new prefix.\n");
271 }
272 else {
273 0 my ($path_vol, $path_dirs) = File::Spec->splitpath( $path );
274 0 my $vms_prefix = $self->config->get('vms_prefix');
275 0 ▶ if ($path_vol eq $vms_prefix.':') {
Branch: 1 branch
BranchTrueFalseTotal
if ($path_vol eq $vms_prefix . ':') { } 0 0 0
276 0 $self->_log_verbose(" $vms_prefix: seen\n");
277  
278 0 ▶ $path_dirs =~ s{^\[}{\[.} unless $path_dirs =~ m{^\[\.};
Branch: 1 branch
BranchTrueFalseTotal
unless $path_dirs =~ /^\[\./ 0 0 0
279 0 $path = $self->_catprefix_vms($rprefix, $path_dirs);
280 }
281 else {
282 0 $self->_log_verbose(" cannot prefixify.\n");
283 0 return File::Spec->catdir($self->prefix_relpaths($self->installdirs, $type));
284 }
285 }
286  
287 0 $self->_log_verbose(" now $path\n");
288  
289 0 return $path;
290 }
291  
292 2 ▶BEGIN { *_prefixify = $^O eq 'VMS' ? \&_prefixify_vms : \&_prefixify_novms }
Subroutine BEGIN: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'VMS' ? : 0 2 2
293  
294 # Translated from ExtUtils::MM_Any::init_INSTALL_from_PREFIX
295 sub prefix_relative {
296 24 ▶ my ($self, $installdirs, $type) = @_;
Subroutine prefix_relative: called CC=1 SCAR=0.0
Pod documented
297  
298 24 my $relpath = $self->install_sets($installdirs, $type);
299  
300 24 return $self->_prefixify($relpath, $self->original_prefix($installdirs), $type);
301 }
302  
303 sub install_destination {
304 69 ▶ my ($self, $type) = @_;
Subroutine install_destination: called CC=6 SCAR=18.1
Pod documented
305  
306 69 ▶ return $self->install_path($type) if $self->install_path($type);
Branch: 1 branch
BranchTrueFalseTotal
if $self->install_path($type) 0 69 69
307  
308 69 ▶ if ( $self->install_base ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->install_base) 23 46 69
309 23 my $relpath = $self->install_base_relpaths($type);
310 23 ▶ return $relpath ? File::Spec->catdir($self->install_base, @{$relpath}) : undef;
Branch: 1 branch
BranchTrueFalseTotal
$relpath ? : 23 0 23
311 }
312  
313 46 ▶ if ( $self->prefix ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->prefix) 24 22 46
314 24 my $relpath = $self->prefix_relative($self->installdirs, $type);
315 24 ▶ return $relpath ? File::Spec->catdir($self->prefix, $relpath) : undef;
Branch: 1 branch
BranchTrueFalseTotal
$relpath ? : 24 0 24
316 }
317 22 return $self->install_sets($self->installdirs, $type);
318 }
319  
320 sub install_types {
321 3 ▶ my $self = shift;
Subroutine install_types: called CC=3 SCAR=11.2
Pod documented
322  
323 3 ▶ my %types = ( %{ $self->{install_path} },
Branch: 1 branch
BranchTrueFalseTotal
$self->install_base ? : 1 2 3
324 1 ▶ $self->install_base ? %{ $self->{install_base_relpaths} }
Branch: 1 branch
BranchTrueFalseTotal
$self->prefix ? : 0 2 2
325 0 : $self->prefix ? %{ $self->{prefix_relpaths}{ $self->installdirs } }
326 3 : %{ $self->{install_sets}{ $self->installdirs } });
327  
328 3 return sort keys %types;
329 }
330  
331 sub install_map {
332 2 ▶ my ($self, $blib) = @_;
Subroutine install_map: called CC=12 SCAR=31.6
Pod documented
333 2 ▶ $blib ||= $self->blib;
Condition33%1/3
$blib ||= $self->blib
l!l&&r!l&&!r
020
MC/DC0%0/2
$blib ||= $self->blib
$blib $self->blib
Truth table33%1/3
A ||= B
A= $blibB= $self->blib
ABresult
1X1
011
000
334  
335 2 my (%map, @skipping);
336 2 foreach my $type ($self->install_types) {
337 16 my $localdir = File::Spec->catdir($blib, $type);
338 16 ▶ next unless -e $localdir;
Branch: 1 branch
BranchTrueFalseTotal
unless -e $localdir 8 8 16
339  
340 # the line "...next if (($type eq 'bindoc'..." was one of many changes introduced for
341 # improving HTML generation on ActivePerl, see https://rt.cpan.org/Public/Bug/Display.html?id=53478
342 # Most changes were ok, but this particular line caused test failures in t/manifypods.t on windows,
343 # therefore it is commented out.
344  
345 # ********* next if (($type eq 'bindoc' || $type eq 'libdoc') && not $self->is_unixish);
346  
347 8 ▶ if (my $dest = $self->install_destination($type)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $dest = $self->install_destination($type)) { } 8 0 8
348 8 $map{$localdir} = $dest;
349 } else {
350 0 push @skipping, $type;
351 }
352 }
353  
354 2 ▶ warn "WARNING: Can't figure out install path for types: @skipping\nFiles will not be installed.\n" if @skipping;
Branch: 1 branch
BranchTrueFalseTotal
if @skipping 0 2 2
355  
356 # Write the packlist into the same place as ExtUtils::MakeMaker.
357 2 ▶ if ($self->create_packlist and my $module_name = $self->module_name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->create_packlist and my $module_name = $self->module_name) 2 0 2
Condition33%1/3
$self->create_packlist and my $module_name = $self->module_name
!ll&&!rl&&r
002
MC/DC0%0/2
$self->create_packlist and my $module_name = $self->module_name
$self->create_packlist my $module_name = $self->module_name
Truth table33%1/3
A and B
A= $self->create_packlistB= my $module_name = $self->module_name
ABresult
0X0
100
111
358 2 my $archdir = $self->install_destination('arch');
359 2 my @ext = split /::/, $module_name;
360 2 $map{write} = File::Spec->catfile($archdir, 'auto', @ext, '.packlist');
361 }
362  
363 # Handle destdir
364 2 ▶ if (length(my $destdir = $self->destdir || '')) {
Branch: 1 branch
BranchTrueFalseTotal
if (length(my $destdir = $self->destdir || "")) 0 2 2
Condition50%1/2
$self->destdir || ''
l!l
02
MC/DC0%0/1
$self->destdir || ''
$self->destdir
Truth table50%1/2
A
A= $self->destdir
Aresult
11
00
365 0 foreach (keys %map) {
366 # Need to remove volume from $map{$_} using splitpath, or else
367 # we'll create something crazy like C:\Foo\Bar\E:\Baz\Quux
368 # VMS will always have the file separate than the path.
369 0 my ($volume, $path, $file) = File::Spec->splitpath( $map{$_}, 0 );
370  
371 # catdir needs a list of directories, or it will create something
372 # crazy like volume:[Foo.Bar.volume.Baz.Quux]
373 0 my @dirs = File::Spec->splitdir($path);
374  
375 # First merge the directories
376 0 $path = File::Spec->catdir($destdir, @dirs);
377  
378 # Then put the file back on if there is one.
379 0 ▶ if ($file ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($file ne '') { } 0 0 0
380 0 $map{$_} = File::Spec->catfile($path, $file)
381 } else {
382 0 $map{$_} = $path;
383 }
384 }
385 }
386  
387 2 $map{read} = ''; # To keep ExtUtils::Install quiet
388  
389 2 return \%map;
390 }
391  
392 2 1;
393  
394 # ABSTRACT: Build.PL install path logic made easy
395  
396 __END__
↑ Summary