To/Text.pm

filter: Statementstmt 24.6% 19 / 77 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 25 MC/DCmcdc 0.0% 0 / 11 Subroutinesub 45.4% 5 / 11 Podpod 0.0% 0 / 6 totaltotal 16.9% 24 / 142 CC 21 SCAR 37.6
CC
21
Cov
17%
gen_doc_section_functions
72.0
gen_doc_section_methods
72.0
gen_doc_section_summary
30.0
CRAP 43.0
« To/POD.pm ↑ Summary To/PackageBase.pm »
1 package Perinci::To::Text;
2  
3 2 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Log::ger;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use Locale::TextDomain::UTF8 'Perinci-To-Doc';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 extends 'Perinci::To::PackageBase';
10 2 with 'Perinci::To::Doc::Role::Section::AddTextLines';
11  
12 2 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
13 2 our $DATE = '2023-07-09'; # DATE
14 2 our $DIST = 'Perinci-To-Doc'; # DIST
15 2 our $VERSION = '0.881'; # VERSION
16  
17 1 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
18 1 my ($self, $args) = @_;
19 }
20  
21 0 ▶sub gen_doc_section_summary {
Subroutine gen_doc_section_summary: not called CC=5 SCAR=34.0
Pod undocumented
22 0 my ($self) = @_;
23  
24 #my $meta = $self->meta;
25 0 my $dres = $self->{_doc_res};
26  
27 0 $self->SUPER::gen_doc_section_summary;
28  
29 my $name_summary = join(
30 "",
31 $dres->{name} // "",
32 ($dres->{name} && $dres->{summary} ? ' - ' : ''),
33 0 ▶ $dres->{summary} // ""
Branch: 1 branch
BranchTrueFalseTotal
$dres->{'name'} && $dres->{'summary'} ? : 0 0 0
Condition0%0/7
$dres->{"name"} // ""
l!l
00
$dres->{"name"} and $dres->{"summary"}
!ll&&!rl&&r
000
$dres->{"summary"} // ""
l!l
00
MC/DC0%0/1
$dres->{"name"} // ""
$dres->{"name"}
MC/DC0%0/2
$dres->{"name"} and $dres->{"summary"}
$dres->{"name"} $dres->{"summary"}
MC/DC0%0/1
$dres->{"summary"} // ""
$dres->{"summary"}
Truth table0%0/2
A
A= $dres->{"name"}
Aresult
11
00
Truth table0%0/3
A and B
A= $dres->{"name"}B= $dres->{"summary"}
ABresult
0X0
100
111
Truth table0%0/2
A
A= $dres->{"summary"}
Aresult
11
00
34 );
35  
36 0 $self->add_doc_lines(uc(__("Name")), "");
37  
38 0 $self->inc_doc_indent;
39 0 $self->add_doc_lines($name_summary);
40 0 $self->dec_doc_indent;
41 }
42  
43 0 ▶sub gen_doc_section_version {
Subroutine gen_doc_section_version: not called CC=2 SCAR=17.9
Pod undocumented
44 0 my ($self) = @_;
45  
46 0 my $meta = $self->meta;
47 #my $dres = $self->{_doc_res};
48  
49 0 $self->add_doc_lines("", uc(__("Version")), "");
50  
51 0 $self->inc_doc_indent;
52 0 ▶ $self->add_doc_lines($meta->{entity_v} // '?');
Condition0%0/2
$meta->{"entity_v"} // "?"
l!l
00
MC/DC0%0/1
$meta->{"entity_v"} // "?"
$meta->{"entity_v"}
Truth table0%0/2
A
A= $meta->{"entity_v"}
Aresult
11
00
53 0 $self->dec_doc_indent;
54 }
55  
56 0 ▶sub gen_doc_section_description {
Subroutine gen_doc_section_description: not called CC=2 SCAR=17.9
Pod undocumented
57 0 my ($self) = @_;
58  
59 0 my $dres = $self->{_doc_res};
60  
61 0 $self->SUPER::gen_doc_section_description;
62 0 ▶ return unless $dres->{description};
Branch: 1 branch
BranchTrueFalseTotal
unless $dres->{"description"} 0 0 0
63  
64 0 $self->add_doc_lines("", uc(__("Description")), "");
65  
66 0 $self->inc_doc_indent;
67 0 $self->add_doc_lines($dres->{description});
68 0 $self->dec_doc_indent;
69 }
70  
71 0 ▶sub _gen_func_doc {
Subroutine _gen_func_doc: not called CC=1 SCAR=6.9
72 0 my $self = shift;
73 0 my $o = Perinci::Sub::To::Text->new(_pa=>$self->{_pa}, @_);
74 0 $o->gen_doc;
75 0 $o->doc_lines;
76 }
77  
78 0 ▶sub gen_doc_section_functions {
Subroutine gen_doc_section_functions: not called CC=8 SCAR=42.8
Pod undocumented
79 0 require Perinci::Sub::To::Text;
80  
81 0 my ($self) = @_;
82  
83 0 my $dres = $self->{_doc_res};
84  
85 0 $self->add_doc_lines("", uc(__("Functions")), "");
86 0 $self->SUPER::gen_doc_section_functions;
87 0 my $i;
88 0 for my $furi (sort keys %{ $dres->{functions} }) {
89 0 ▶ $self->add_doc_lines('') if $i++;
Branch: 1 branch
BranchTrueFalseTotal
if $i++ 0 0 0
90 0 my $meta = $dres->{function_metas}{$furi};
91 0 ▶ next if ($meta->{is_meth} || $meta->{is_class_meth}) && !($meta->{is_func} // 1);
Branch: 1 branch
BranchTrueFalseTotal
if $meta->{"is_meth"} || $meta->{"is_class_meth"} and not $meta->{"is_func"} // 1 0 0 0
Condition0%0/8
$meta->{"is_meth"} || $meta->{"is_class_meth"} and not $meta->{"is_func"} // 1
!ll&&!rl&&r
000
$meta->{"is_meth"} or $meta->{"is_class_meth"}
l!l&&r!l&&!r
000
$meta->{"is_func"} // 1
l!l
00
MC/DC0%0/3
$meta->{"is_meth"} || $meta->{"is_class_meth"} and not $meta->{"is_func"} // 1
$meta->{"is_meth"} $meta->{"is_class_meth"} $meta->{"is_func"}
Truth table0%0/5
A or B and not(C)
A= $meta->{"is_meth"}B= $meta->{"is_class_meth"}C= $meta->{"is_func"}
ABCresult
00X0
1X10
0110
1X01
0101
92 0 for (@{ $dres->{functions}{$furi} }) {
93 0 chomp;
94 0 $self->add_doc_lines({wrap=>0}, $_);
95 }
96 }
97 0 $self->add_doc_lines('');
98 }
99  
100 0 ▶sub gen_doc_section_methods {
Subroutine gen_doc_section_methods: not called CC=8 SCAR=42.8
Pod undocumented
101 0 require Perinci::Sub::To::Text;
102  
103 0 my ($self) = @_;
104  
105 0 my $dres = $self->{_doc_res};
106  
107 0 $self->add_doc_lines("", uc(__("Methods")), "");
108 0 $self->SUPER::gen_doc_section_methods;
109 0 my $i;
110 0 for my $furi (sort keys %{ $dres->{functions} }) {
111 0 ▶ $self->add_doc_lines('') if $i++;
Branch: 1 branch
BranchTrueFalseTotal
if $i++ 0 0 0
112 0 my $meta = $dres->{function_metas}{$furi};
113 0 ▶ next unless ($meta->{is_meth} || $meta->{is_class_meth}) && !($meta->{is_func} // 1);
Branch: 1 branch
BranchTrueFalseTotal
unless $meta->{"is_meth"} || $meta->{"is_class_meth"} and not $meta->{"is_func"} // 1 0 0 0
Condition0%0/8
$meta->{"is_meth"} || $meta->{"is_class_meth"} and not $meta->{"is_func"} // 1
!ll&&!rl&&r
000
$meta->{"is_meth"} or $meta->{"is_class_meth"}
l!l&&r!l&&!r
000
$meta->{"is_func"} // 1
l!l
00
MC/DC0%0/3
$meta->{"is_meth"} || $meta->{"is_class_meth"} and not $meta->{"is_func"} // 1
$meta->{"is_meth"} $meta->{"is_class_meth"} $meta->{"is_func"}
Truth table0%0/5
A or B and not(C)
A= $meta->{"is_meth"}B= $meta->{"is_class_meth"}C= $meta->{"is_func"}
ABCresult
00X0
1X10
0110
1X01
0101
114 0 for (@{ $dres->{functions}{$furi} }) {
115 0 chomp;
116 0 $self->add_doc_lines({wrap=>0}, $_);
117 }
118 }
119 0 $self->add_doc_lines('');
120 }
121  
122 2 1;
123 # ABSTRACT: Generate text documentation for a package from Rinci metadata
124  
125 __END__
« To/POD.pm ↑ Summary To/PackageBase.pm »