scripts/podtidy

filter: Statementstmt 90.9% 30 / 33 Branchbran 42.8% 6 / 14 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 64.1% 43 / 67 CC 1 SCAR 0.0
CC
1
Cov
64%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Pod/Wrap/Pretty.pm ↑ Summary
1 #!/usr/bin/perl
2  
3 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use warnings FATAL => qw( all );
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 11 ▶use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 11 $VERSION = '0.04';
8  
9 11 ▶use Pod::Tidy;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 11 ▶use Text::Glob qw( glob_to_regex );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 11 ▶use Getopt::Long qw( GetOptions :config auto_version auto_help gnu_getopt );
Subroutine BEGIN: called CC=1 SCAR=0.0
13 11 ▶use Pod::Usage qw( pod2usage );
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 11 my ($inplace, $ignore, $nobackup, $recursive, $verbose, $columns);
16 # for some reason the single letter abv.s must be explicitly declared when
17 # bundling is enabled
18 11 ▶GetOptions(
Branch: 1 branch
BranchTrueFalseTotal
&GetOptions("inplace|i", \$inplace, "Ignore|I=s\@", \$ignore, "nobackup|n", \$nobackup, "recursive|r", \$recursive, "verbose|v", \$verbose, "columns|c=i", \$columns) or pod2usage(2) 8 0 8
19 'inplace|i' => \$inplace,
20 'Ignore|I=s@' => \$ignore,
21 'nobackup|n' => \$nobackup,
22 'recursive|r' => \$recursive,
23 'verbose|v' => \$verbose,
24 'columns|c=i' => \$columns,
25 ) or pod2usage( 2 );
26  
27 8 ▶unless (@ARGV) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@ARGV) 0 8 8
28 0 ▶ pod2usage( -msg => "Options: --Ignore --inplace --nobackup --recursive require <filelist>", -exitval => 2 )
Branch: 1 branch
BranchTrueFalseTotal
if $ignore or $inplace or $nobackup or $recursive 0 0 0
Condition0%0/9
$ignore or $inplace or $nobackup or $recursive
l!l&&r!l&&!r
000
$ignore or $inplace or $nobackup
l!l&&r!l&&!r
000
$ignore or $inplace
l!l&&r!l&&!r
000
MC/DC0%0/4
$ignore or $inplace or $nobackup or $recursive
$ignore $inplace $nobackup $recursive
Truth table0%0/5
A or B or C or D
A= $ignoreB= $inplaceC= $nobackupD= $recursive
ABCDresult
1XXX1
01XX1
001X1
00011
00000
29 if $ignore or $inplace or $nobackup or $recursive;
30 }
31  
32 8 ▶if ($nobackup) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nobackup) 1 7 8
33 1 ▶ pod2usage( -msg => "Option: --nobackup requires --inplace", -exitval => 2 )
Branch: 1 branch
BranchTrueFalseTotal
unless $inplace 0 1 1
34 unless $inplace;
35 }
36  
37 8 ▶if (@ARGV) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ARGV) { } 8 0 8
38 # handle files/dir
39 Pod::Tidy::tidy_files(
40 files => [@ARGV],
41 recursive => $recursive,
42 verbose => $verbose,
43 inplace => $inplace,
44 8 ignore => [map { glob_to_regex($_) } @$ignore],
45 nobackup => $nobackup,
46 columns => $columns,
47 );
48 } else {
49 # always filter STDIN - we don't know how large or how slow it will be
50 0 ▶ open(my $input, '-') or die "can't open STDIN: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $input, "-" or die "can't open STDIN: $!" 0 0 0
51 0 Pod::Tidy::tidy_filehandle($input);
52 }
53  
54 1;
55  
56 __END__
« lib/Pod/Wrap/Pretty.pm ↑ Summary