bin/podtoc

filter: Statementstmt 92.5% 25 / 27 Branchbran 92.8% 13 / 14 Conditioncond 83.3% 5 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 88.6% 47 / 53 CC 1 SCAR 0.0
CC
1
Cov
91%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« bin/pfcat ↑ Summary bin/podpath »
1 #!/usr/bin/env perl
2 # podtoc -- show outline of pods
3  
4 # ------ pragmas
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '2.0.0';
9  
10 # ------ define variables
11 1 my $inpod = undef;
12  
13 1 $/ = '';
14  
15 1 $inpod = 0;
16 1 ▶while (<>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline ARGV)) 26 1 27
17 26 ▶ print "$ARGV\n" if $. == 1;
Branch: 1 branch
BranchTrueFalseTotal
if $. == 1 1 25 26
18 26 ▶ if ($inpod && /^=cut/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($inpod and /^=cut/) 0 26 26
Condition66%2/3
$inpod and /^=cut/
!ll&&!rl&&r
13130
MC/DC0%0/2
$inpod and /^=cut/
$inpod /^=cut/
Truth table66%2/3
A and B
A= $inpodB= /^=cut/
ABresult
0X0
100
111
19 0 $inpod = 0;
20 0 next;
21 }
22  
23 26 ▶ if (! $inpod && /^=(?!cut)\w+/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $inpod and /^=(?!cut)\w+/) 1 25 26
Condition100%3/3
not $inpod and /^=(?!cut)\w+/
!ll&&!rl&&r
13121
MC/DC100%2/2
not $inpod and /^=(?!cut)\w+/
not $inpod /^=(?!cut)\w+/
Truth table100%3/3
not(A) and B
A= not $inpodB= /^=(?!cut)\w+/
ABresult
0X0
100
111
24 1 $inpod = 1;
25 }
26  
27 26 ▶ if ($inpod) {
Branch: 1 branch
BranchTrueFalseTotal
if ($inpod) 14 12 26
28 14 ▶ next unless /^=(?:head|item)/;
Branch: 1 branch
BranchTrueFalseTotal
unless /^=(?:head|item)/ 8 6 14
29 6 s/=head(\d)/' ' x ( $1 - 1 )/e;
30 6 s/=item/ * /;
31 6 s/\n+$/\n/;
32 6 print;
33 }
34  
35  
36 } continue {
37  
38 26 ▶ if (eof) {
Branch: 1 branch
BranchTrueFalseTotal
if (eof) 1 25 26
39 1 $inpod = 0;
40 1 close ARGV;
41 }
42  
43 }
44  
45 __END__
« bin/pfcat ↑ Summary bin/podpath »