Simple/Text.pm

filter: Statementstmt 87.6% 71 / 81 Branchbran 66.6% 8 / 12 Conditioncond 75.0% 3 / 4 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 73.6% 28 / 38 Podpod 3.2% 1 / 31 totaltotal 66.6% 112 / 168 CC 9 SCAR 5.7
CC
9
Cov
85%
start_item_number
6.0
end_L
3.0
BEGIN
2.1
CRAP 1.8
« Simple/JustPod.pm ↑ Summary Simple/TranscodeSmart.pm »
1 package Pod::Simple::Text;
2 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use Pod::Simple::Methody ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use Pod::Simple ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 our $VERSION = '3.48';
8 6 our @ISA = ('Pod::Simple::Methody');
9 6 ▶BEGIN { *DEBUG = defined(&Pod::Simple::DEBUG)
Subroutine BEGIN: called CC=2 SCAR=7.6
10 ? \&Pod::Simple::DEBUG
11 : sub() {0}
12 6 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
defined &Pod::Simple::DEBUG ? : 6 0 6
13  
14 6 our $FREAKYMODE;
15  
16 6 ▶use Text::Wrap 98.112902 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19  
20 33 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
21 33 my $self = shift;
22 33 my $new = $self->SUPER::new(@_);
23 33 ▶ $new->{'output_fh'} ||= *STDOUT{IO};
Condition50%1/2
$new->{"output_fh"} ||= *STDOUT{"IO"}
l!l
033
MC/DC0%0/1
$new->{"output_fh"} ||= *STDOUT{"IO"}
$new->{"output_fh"}
Truth table50%1/2
A
A= $new->{"output_fh"}
Aresult
11
00
24 33 $new->accept_target_as_text(qw( text plaintext plain ));
25 33 $new->nix_X_codes(1);
26 33 $new->nbsp_for_S(1);
27 33 $new->{'Thispara'} = '';
28 33 $new->{'Indent'} = 0;
29 33 $new->{'Indentstring'} = ' ';
30 33 return $new;
31 }
32  
33 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34  
35 3588 ▶sub handle_text { $_[0]{'Thispara'} .= $_[1] }
Subroutine handle_text: called CC=1 SCAR=0.0
Pod undocumented
36  
37 807 ▶sub start_Para { $_[0]{'Thispara'} = '' }
Subroutine start_Para: called CC=1 SCAR=0.0
Pod undocumented
38 45 ▶sub start_head1 { $_[0]{'Thispara'} = '' }
Subroutine start_head1: called CC=1 SCAR=0.0
Pod undocumented
39 98 ▶sub start_head2 { $_[0]{'Thispara'} = '' }
Subroutine start_head2: called CC=1 SCAR=0.0
Pod undocumented
40 0 ▶sub start_head3 { $_[0]{'Thispara'} = '' }
Subroutine start_head3: not called CC=1 SCAR=6.9
Pod undocumented
41 0 ▶sub start_head4 { $_[0]{'Thispara'} = '' }
Subroutine start_head4: not called CC=1 SCAR=6.9
Pod undocumented
42  
43 146 ▶sub start_Verbatim { $_[0]{'Thispara'} = '' }
Subroutine start_Verbatim: called CC=1 SCAR=0.0
Pod undocumented
44 58 ▶sub start_item_bullet { $_[0]{'Thispara'} = $FREAKYMODE ? '' : '* ' }
Subroutine start_item_bullet: called CC=2 SCAR=7.6
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$Pod::Simple::Text::FREAKYMODE ? : 58 0 58
45 0 ▶sub start_item_number { $_[0]{'Thispara'} = $FREAKYMODE ? '' : "$_[1]{'number'}. " }
Subroutine start_item_number: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$Pod::Simple::Text::FREAKYMODE ? : 0 0 0
46 365 ▶sub start_item_text { $_[0]{'Thispara'} = '' }
Subroutine start_item_text: called CC=1 SCAR=0.0
Pod undocumented
47  
48 12 ▶sub start_over_bullet { ++$_[0]{'Indent'} }
Subroutine start_over_bullet: called CC=1 SCAR=0.0
Pod undocumented
49 0 ▶sub start_over_number { ++$_[0]{'Indent'} }
Subroutine start_over_number: not called CC=1 SCAR=6.9
Pod undocumented
50 27 ▶sub start_over_text { ++$_[0]{'Indent'} }
Subroutine start_over_text: called CC=1 SCAR=0.0
Pod undocumented
51 0 ▶sub start_over_block { ++$_[0]{'Indent'} }
Subroutine start_over_block: not called CC=1 SCAR=6.9
Pod undocumented
52  
53 12 ▶sub end_over_bullet { --$_[0]{'Indent'} }
Subroutine end_over_bullet: called CC=1 SCAR=0.0
Pod undocumented
54 0 ▶sub end_over_number { --$_[0]{'Indent'} }
Subroutine end_over_number: not called CC=1 SCAR=6.9
Pod undocumented
55 27 ▶sub end_over_text { --$_[0]{'Indent'} }
Subroutine end_over_text: called CC=1 SCAR=0.0
Pod undocumented
56 0 ▶sub end_over_block { --$_[0]{'Indent'} }
Subroutine end_over_block: not called CC=1 SCAR=6.9
Pod undocumented
57  
58  
59 # . . . . . Now the actual formatters:
60  
61 45 ▶sub end_head1 { $_[0]->emit_par(-4) }
Subroutine end_head1: called CC=1 SCAR=0.0
Pod undocumented
62 98 ▶sub end_head2 { $_[0]->emit_par(-3) }
Subroutine end_head2: called CC=1 SCAR=0.0
Pod undocumented
63 0 ▶sub end_head3 { $_[0]->emit_par(-2) }
Subroutine end_head3: not called CC=1 SCAR=6.9
Pod undocumented
64 0 ▶sub end_head4 { $_[0]->emit_par(-1) }
Subroutine end_head4: not called CC=1 SCAR=6.9
Pod undocumented
65 807 ▶sub end_Para { $_[0]->emit_par( 0) }
Subroutine end_Para: called CC=1 SCAR=0.0
Pod undocumented
66 58 ▶sub end_item_bullet { $_[0]->emit_par( 0) }
Subroutine end_item_bullet: called CC=1 SCAR=0.0
Pod undocumented
67 0 ▶sub end_item_number { $_[0]->emit_par( 0) }
Subroutine end_item_number: not called CC=1 SCAR=6.9
Pod undocumented
68 365 ▶sub end_item_text { $_[0]->emit_par(-2) }
Subroutine end_item_text: called CC=1 SCAR=0.0
Pod undocumented
69 124 ▶sub start_L { $_[0]{'Link'} = $_[1] if $_[1]->{type} eq 'url' }
Subroutine start_L: called CC=2 SCAR=6.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if $_[1]{"type"} eq "url" 9 115 124
70 124 ▶sub end_L {
Subroutine end_L: called CC=3 SCAR=11.0
Pod undocumented
71 124 ▶ if (my $link = delete $_[0]{'Link'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $link = delete $_[0]{"Link"}) 9 115 124
72 # Append the URL to the output unless it's already present.
73 $_[0]{'Thispara'} .= " <$link->{to}>"
74 9 ▶ unless $_[0]{'Thispara'} =~ /\b\Q$link->{to}/;
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]{"Thispara"} =~ /\b\Q$link->{"to"}\E/ 2 7 9
75 }
76 }
77  
78 1373 ▶sub emit_par {
Subroutine emit_par: called CC=2 SCAR=6.9
Pod undocumented
79 1373 my($self, $tweak_indent) = splice(@_,0,2);
80 1373 ▶ my $indent = ' ' x ( 2 * $self->{'Indent'} + 4 + ($tweak_indent||0) );
Condition100%2/2
$tweak_indent || 0
l!l
508865
MC/DC100%1/1
$tweak_indent || 0
$tweak_indent
Truth table100%2/2
A
A= $tweak_indent
Aresult
11
00
81 # Yes, 'STRING' x NEGATIVE gives '', same as 'STRING' x 0
82  
83 1373 $self->{'Thispara'} =~ s/$Pod::Simple::shy//g;
84 1373 local $Text::Wrap::huge = 'overflow';
85 1373 my $out = Text::Wrap::wrap($indent, $indent, $self->{'Thispara'} .= "\n");
86 1373 $out =~ s/$Pod::Simple::nbsp/ /g;
87 1373 print {$self->{'output_fh'}} $out, "\n";
88 1373 $self->{'Thispara'} = '';
89  
90 1373 return;
91 }
92  
93 # . . . . . . . . . . And then off by its lonesome:
94  
95 146 ▶sub end_Verbatim {
Subroutine end_Verbatim: called CC=1 SCAR=0.0
Pod undocumented
96 146 my $self = shift;
97 146 $self->{'Thispara'} =~ s/$Pod::Simple::nbsp/ /g;
98 146 $self->{'Thispara'} =~ s/$Pod::Simple::shy//g;
99  
100 146 my $i = ' ' x ( 2 * $self->{'Indent'} + 4);
101 #my $i = ' ' x (4 + $self->{'Indent'});
102  
103 146 $self->{'Thispara'} =~ s/^/$i/mg;
104  
105 146 print { $self->{'output_fh'} } '',
106 146 $self->{'Thispara'},
107 "\n\n"
108 ;
109 146 $self->{'Thispara'} = '';
110 146 return;
111 }
112  
113 #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
114 6 1;
115  
116  
117 __END__
« Simple/JustPod.pm ↑ Summary Simple/TranscodeSmart.pm »