| 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
| |||||||||||||||||||||||||||||
| 17 | 26 | ▶ | print "$ARGV\n" if $. == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | 26 | ▶ | if ($inpod && /^=cut/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$inpod and /^=cut/
MC/DC0%0/2
$inpod and /^=cut/
$inpod
/^=cut/
Truth table66%2/3
A and B
A= $inpodB= /^=cut/
| |||||||||||||||||||||||||||||
| 19 | 0 | $inpod = 0; | |||||||||||||||||||||||||||
| 20 | 0 | next; | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 26 | ▶ | if (! $inpod && /^=(?!cut)\w+/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $inpod and /^=(?!cut)\w+/
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+/
| |||||||||||||||||||||||||||||
| 24 | 1 | $inpod = 1; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 26 | ▶ | if ($inpod) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | 14 | ▶ | next unless /^=(?:head|item)/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 39 | 1 | $inpod = 0; | |||||||||||||||||||||||||||
| 40 | 1 | close ARGV; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||||||||||