meta/tail-expand

filter: Statementstmt 95.0% 38 / 40 Branchbran 72.2% 13 / 18 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 90.0% 63 / 70 CC 3 SCAR 5.5
CC
3
Cov
89%
executable
3.2
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« lib/Chj/Packages.pm ↑ Summary lib/FP/DBI.pm »
1 #!/usr/bin/env perl
2  
3 # Copyright (c) 2015-2019 Christian Jaeger, copying@christianjaeger.ch
4 # This is free software. See the file COPYING.md that came bundled
5 # with this file.
6  
7 # Expand some .pm files to avoid dependency on Sub::Call::Tail:
8  
9 # (XX could also include intro/more_tailcalls here and call this
10 # instead from t/trampoline-fix, but so what)
11  
12 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use warnings FATAL => 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 3 ▶use lib "./lib";
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶use Chj::xperlfunc qw(dirname xxsystem_safe xLmtime XLmtime xmkdir_p);
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 3 my $windows = 1; #($^O =~ /win32/i);
20  
21 12 ▶sub executable {
Subroutine executable: called CC=3 SCAR=11.6
22 12 my ($path) = @_;
23 12 ▶ if ($windows) {
Branch: 1 branch
BranchTrueFalseTotal
if ($windows) { } 12 0 12
24  
25 # -x apparently doesn't work; thus:
26 12 ▶ open my $in, "<", $path or die "open '$path': $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $in, "<", $path or die "open '${path}': $!" 12 0 12
27 12 my $line = <$in>;
28 12 close $in;
29 12 $line =~ /^#!/
30 } else {
31 0 -x $path
32 }
33 }
34  
35 3 ▶open my $manif, "<", "MANIFEST" or die "$!";
Branch: 1 branch
BranchTrueFalseTotal
open my $manif, "<", "MANIFEST" or die "$!" 3 0 3
36  
37 3 local $_;
38 3 ▶while (<$manif>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $manif)) 972 3 975
39 972 chomp;
40 972 ▶ next unless m{^htmlgen/}; # if m{^(?:lib|meta)/};
Branch: 1 branch
BranchTrueFalseTotal
unless m[^htmlgen/] 915 57 972
41 57 ▶ next unless m|\.pm$| or executable $_;
Branch: 1 branch
BranchTrueFalseTotal
unless /\.pm$/ or executable($_) 9 48 57
Condition100%3/3
/\.pm$/ or executable($_)
l!l&&r!l&&!r
4539
MC/DC100%2/2
/\.pm$/ or executable($_)
/\.pm$/ executable($_)
Truth table100%3/3
A or B
A= /\.pm$/B= executable($_)
ABresult
1X1
011
000
42 48 my $from = $_;
43 48 my $to = "." . $from;
44  
45 48 my $t_from = xLmtime $from;
46 16 ▶ my $expand = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
47 16 xxsystem_safe($^X, "bin/expand-tail", $from, $to);
48 48 };
49 48 ▶ if (my $t_to = XLmtime $to) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $t_to = XLmtime($to)) { } 32 16 48
50 32 ▶ if ($t_from >= $t_to) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t_from >= $t_to) 0 32 32
51 0 &$expand;
52 }
53 } else {
54 16 xmkdir_p dirname $to;
55 16 &$expand;
56 }
57 }
58  
59 3 ▶close $manif or die $!;
Branch: 1 branch
BranchTrueFalseTotal
close $manif or die $! 3 0 3
60  
« lib/Chj/Packages.pm ↑ Summary lib/FP/DBI.pm »