Usage/Pod/Text.pm

filter: Statementstmt 100% 27 / 27 Branchbran 66.6% 8 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 3 / 3 totaltotal 91.6% 44 / 48 CC 7 SCAR 11.1
CC
7
Cov
90%
heading
4.1
new
4.1
BEGIN
1.0
CRAP 3.0
« Usage.pm ↑ Summary Usage/Role/Man.pm »
1 package MooseX::Getopt::Usage::Pod::Text;
2  
3 44 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 44 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 44 our $VERSION = '0.24';
6  
7 44 ▶use base qw(Pod::Text);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 26 ▶sub new {
Subroutine new: called CC=4 SCAR=14.0
Pod documented
10 26 my $proto = shift;
11 26 my %args = @_;
12 26 my $self = $proto->SUPER::new(@_);
13 26 ▶ return unless $self;
Branch: 1 branch
BranchTrueFalseTotal
unless $self 0 26 26
14 26 ▶ $self->{headings} = exists $args{headings} ? $args{headings} : 1;
Branch: 1 branch
BranchTrueFalseTotal
exists $args{'headings'} ? : 26 0 26
15 26 ▶ $self->{opt_indent} = 0 if !$self->{headings};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"headings"} 2 24 26
16 26 return $self;
17 }
18  
19 52 ▶sub heading {
Subroutine heading: called CC=4 SCAR=14.0
Pod documented
20 52 my ($self, $text, $indent, $marker) = @_;
21 52 ▶ return unless $self->{headings};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"headings"} 3 49 52
22 # Try to do some lowercasing instead of all-caps in headings, and use
23 # a colon to end all headings.
24 49 ▶ $text =~ s{([A-Z])([A-Z]+)}{((length($2) > 2) ? $1 : lc($1)) . lc($2)}ge;
Branch: 1 branch
BranchTrueFalseTotal
length $2 > 2 ? : 49 0 49
25 49 ▶ $text .= ":" unless $text =~ /:$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $text =~ /:$/ 49 0 49
26 49 return $self->SUPER::heading($text, $indent, $marker);
27 }
28  
29 52 ▶sub cmd_head1 {
Subroutine cmd_head1: called CC=1 SCAR=0.0
Pod documented
30 52 my ($self, $attrs, $text) = @_;
31 52 $text =~ s{SYNOPSIS}{USAGE};
32 52 $self->SUPER::cmd_head1($attrs, $text);
33 }
34  
35 44 1;
36 __END__
« Usage.pm ↑ Summary Usage/Role/Man.pm »