blib/lib/Alien/Build/Plugin/Build/Copy.pm

filter: Statementstmt 80.0% 20 / 25 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 71.4% 30 / 42 CC 4 SCAR 12.4
CC
4
Cov
72%
init
6.8
__ANON__
2.0
BEGIN
1.0
CRAP 3.4
« blib/lib/Alien/Build/Plugin/Build/Autoconf.pm ↑ Summary blib/lib/Alien/Build/Plugin/Decode/HTML.pm »
1 package Alien::Build::Plugin::Build::Copy;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use 5.008004;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Alien::Build::Plugin;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Path::Tiny ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # ABSTRACT: Copy plugin for Alien::Build
10 2 our $VERSION = '2.88'; # VERSION
11  
12  
13 sub init
14 1 ▶{
Subroutine init: called CC=4 SCAR=19.2
Pod documented
15 1 my($self, $meta) = @_;
16  
17 1 $meta->add_requires( 'configure', __PACKAGE__, 0);
18  
19 1 ▶ if($^O eq 'MSWin32')
Branch: 2 branches
BranchTrueFalseTotal
if ($^O eq 'MSWin32') { } 0 1 1
elsif ($^O eq 'darwin' or $^O eq 'solaris') { } 0 1 1
20 {
21 0 ▶ $meta->register_hook(build => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
22 0 my($build) = @_;
23 0 my $stage = Path::Tiny->new($build->install_prop->{stage})->canonpath;
24 0 $build->system(qq{xcopy . "$stage" /E});
25 0 });
26 }
27 ▶ elsif($^O eq 'darwin' || $^O eq 'solaris')
Condition33%1/3
$^O eq "darwin" or $^O eq "solaris"
l!l&&r!l&&!r
001
MC/DC0%0/2
$^O eq "darwin" or $^O eq "solaris"
$^O eq "darwin" $^O eq "solaris"
Truth table33%1/3
A or B
A= $^O eq "darwin"B= $^O eq "solaris"
ABresult
1X1
011
000
28 {
29 # On recent macOS -pPR is the same as -aR
30 # on older Mac OS X (10.5 at least) -a is not supported but -pPR is.
31  
32 # Looks like -pPR should also work on coreutils if for some reason
33 # someone is using coreutils on macOS, although there are semantic
34 # differences between -pPR and -aR on coreutils, that may or may not be
35 # important enough to care about.
36  
37 # Solaris /usr/bin/cp and /usr/xpg4/bin/cp don't support -a at all,
38 # but do support -p, -P and -R.
39  
40 0 $meta->register_hook(build => [
41 'cp -pPR * "%{.install.stage}"',
42 ]);
43 }
44 else
45 {
46 # TODO: some platforms might not support -a
47 # I think most platforms will support -r
48 1 $meta->register_hook(build => [
49 'cp -aR * "%{.install.stage}"',
50 ]);
51 }
52 }
53  
54 2 1;
55  
56 __END__
« blib/lib/Alien/Build/Plugin/Build/Autoconf.pm ↑ Summary blib/lib/Alien/Build/Plugin/Decode/HTML.pm »