bin/substitute-letters

filter: Statementstmt 100% 47 / 47 Branchbran 83.3% 10 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 97.1% 67 / 69 CC 1 SCAR 0.0
CC
1
Cov
97%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Text/UnicodeStyle/Monospace.pm ↑ Summary
1 #!/usr/bin/env perl
2 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 7 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 7 ▶use open ':std', ':encoding(UTF-8)';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 ▶use Getopt::Long qw(:config posix_default no_ignore_case);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 7 ▶use Pod::Usage;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 7 ▶use FindBin;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 7 ▶use lib "$FindBin::RealBin/../lib";
Subroutine BEGIN: called CC=1 SCAR=0.0
12 7 ▶use Text::UnicodeStyle qw( stylize styles );
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 7 my $style = 'monospace';
15 7 my $help;
16 my $list;
17  
18 7 ▶GetOptions(
Branch: 1 branch
BranchTrueFalseTotal
&GetOptions("style|s=s", \$style, "list|l", \$list, "help|h|?", \$help) or pod2usage(2) 7 0 7
19 'style|s=s' => \$style,
20 'list|l' => \$list,
21 'help|h|?' => \$help,
22 ) or pod2usage(2);
23  
24 7 ▶pod2usage({ -verbose => 2, -exitval => 0 }) if $help;
Branch: 1 branch
BranchTrueFalseTotal
if $help 3 4 7
25  
26 4 ▶if ($list) {
Branch: 1 branch
BranchTrueFalseTotal
if ($list) 1 3 4
27 1 say for styles();
28 1 exit 0;
29 }
30  
31 3 my %known = map { $_ => 1 } styles();
32 pod2usage("Unknown style '$style'. Available: " . join(', ', styles()))
33 3 ▶ unless $known{$style};
Branch: 1 branch
BranchTrueFalseTotal
unless $known{$style} 1 2 3
34  
35 2 my $text;
36 2 ▶if (@ARGV) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ARGV) { } 1 1 2
37 1 $text = join ' ', @ARGV;
38 }
39 else {
40 1 local $/;
41 1 $text = <STDIN>;
42 1 ▶ defined $text or pod2usage(2);
Branch: 1 branch
BranchTrueFalseTotal
defined $text or pod2usage(2) 1 0 1
43 1 $text =~ s/\s+\z//;
44 }
45  
46 2 say stylize($text, $style);
47  
48 __END__
« lib/Text/UnicodeStyle/Monospace.pm ↑ Summary