| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | pod2usage( -msg => "Options: --Ignore --inplace --nobackup --recursive require <filelist>", -exitval => 2 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$ignore or $inplace or $nobackup or $recursive
$ignore or $inplace or $nobackup
$ignore or $inplace
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | if $ignore or $inplace or $nobackup or $recursive; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 8 | ▶ | if ($nobackup) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | pod2usage( -msg => "Option: --nobackup requires --inplace", -exitval => 2 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | unless $inplace; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 8 | ▶ | if (@ARGV) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | Pod::Tidy::tidy_filehandle($input); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||