lib/OODoc/Format.pm

filter: Statementstmt 10.4% 22 / 210 Branchbran 0.0% 0 / 136 Conditioncond 0.0% 0 / 85 MC/DCmcdc 0.0% 0 / 51 Subroutinesub 12.5% 6 / 48 Podpod 70.0% 28 / 40 totaltotal 9.8% 56 / 570 CC 112 SCAR 62.8
CC
112
Cov
5%
showSubroutine
1560.0
showChapter
702.0
showSubroutines
240.0
CRAP 534.1
↑ Summary lib/OODoc.pm »
1 # This code is part of Perl distribution OODoc version 3.05.
2 # The POD got stripped from this file by OODoc version 3.05.
3 # For contributors see file ChangeLog.
4  
5 # This software is copyright (c) 2003-2025 by Mark Overmeer.
6  
7 # This is free software; you can redistribute it and/or modify it under
8 # the same terms as the Perl 5 programming language system itself.
9 # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later
10  
11  
12 package OODoc::Format;{
13 2 our $VERSION = '3.05';
14 }
15  
16 2 ▶use parent 'OODoc::Object';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 2 ▶use Log::Report 'oodoc';
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 2 ▶use OODoc::Manifest ();
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use Scalar::Util qw/weaken/;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 2 our %formatters = (
27 pod => 'OODoc::Format::Pod',
28 pod2 => 'OODoc::Format::Pod2',
29 pod3 => 'OODoc::Format::Pod3',
30 html => 'OODoc::Format::Html',
31 html2 => 'OODoc::Format::Html2', # not (yet) included in the OODoc release
32 );
33  
34 #--------------------
35  
36 sub new($%)
37 0 ▶{ my ($class, %args) = @_;
Subroutine new: not called CC=5 SCAR=34.0
Pod documented
38  
39 0 ▶ $class eq __PACKAGE__
Branch: 1 branch
BranchTrueFalseTotal
$class eq __PACKAGE__ or return $class->SUPER::new(%args) 0 0 0
40 or return $class->SUPER::new(%args);
41  
42 0 ▶ my $format = $args{format} or error __x"no formatter specified";
Branch: 1 branch
BranchTrueFalseTotal
my $format = $args{"format"} or &error(&__x("no formatter specified")) 0 0 0
43 0 ▶ my $pkg = $formatters{$format} || $format;
Condition0%0/3
$OODoc::Format::formatters{$format} || $format
l!l&&r!l&&!r
000
MC/DC0%0/2
$OODoc::Format::formatters{$format} || $format
$OODoc::Format::formatters{$format} $format
Truth table0%0/3
A || B
A= $OODoc::Format::formatters{$format}B= $format
ABresult
1X1
011
000
44  
45 0 eval "require $pkg";
46 0 ▶ $@ and error __x"formatter {name} has compilation errors: {err}", name => $format, err => $@;
Branch: 1 branch
BranchTrueFalseTotal
$@ and &error(&__x("formatter {name} has compilation errors: {err}", "name", $format, "err", $@)) 0 0 0
47  
48 0 $pkg->new(%args);
49 }
50  
51 sub init($)
52 0 ▶{ my ($self, $args) = @_;
Subroutine init: not called CC=7 SCAR=40.3
Pod undocumented
53  
54 0 ▶ $self->SUPER::init($args) or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init($args) or return 0 0 0
55 0 $self->{OF_format} = delete $args->{format};
56  
57 my $name = $self->{OF_project} = delete $args->{project}
58 0 ▶ or error __x"formatter knows no project name";
Branch: 1 branch
BranchTrueFalseTotal
my $name = $self->{"OF_project"} = delete $args->{"project"} or &error(&__x("formatter knows no project name")) 0 0 0
59  
60 $self->{OF_version} = delete $args->{version}
61 0 ▶ or error __x"formatter for {name} does not know the version", name => $name;
Branch: 1 branch
BranchTrueFalseTotal
$self->{"OF_version"} = delete $args->{"version"} or &error(&__x("formatter for {name} does not know the version", "name", $name)) 0 0 0
62  
63 $self->{OF_workdir} = delete $args->{workdir}
64 0 ▶ or error __x"no working directory specified for {name}", name => $name;
Branch: 1 branch
BranchTrueFalseTotal
$self->{"OF_workdir"} = delete $args->{"workdir"} or &error(&__x("no working directory specified for {name}", "name", $name)) 0 0 0
65  
66 0 ▶ $self->{OF_manifest} = delete $args->{manifest} || OODoc::Manifest->new;
Condition0%0/3
delete $args->{'manifest'} || 'OODoc::Manifest'->new
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $args->{'manifest'} || 'OODoc::Manifest'->new
delete $args->{'manifest'} 'OODoc::Manifest'->new
Truth table0%0/3
A || B
A= delete $args->{'manifest'}B= 'OODoc::Manifest'->new
ABresult
1X1
011
000
67  
68 0 ▶ $self->{OF_index} = delete $args->{index} or error __x"no index specified";
Branch: 1 branch
BranchTrueFalseTotal
$self->{"OF_index"} = delete $args->{"index"} or &error(&__x("no index specified")) 0 0 0
69 0 weaken($self->{OF_index});
70  
71 0 $self;
72 }
73  
74 0 ▶sub publish { panic }
Subroutine publish: not called CC=1 SCAR=6.9
Pod documented
75  
76 #--------------------
77  
78 0 ▶sub project() { $_[0]->{OF_project} }
Subroutine project: not called CC=1 SCAR=6.9
Pod documented
79  
80  
81 0 ▶sub version() { $_[0]->{OF_version} }
Subroutine version: not called CC=1 SCAR=6.9
Pod documented
82 0 ▶sub workdir() { $_[0]->{OF_workdir} }
Subroutine workdir: not called CC=1 SCAR=6.9
Pod documented
83 0 ▶sub manifest() { $_[0]->{OF_manifest} }
Subroutine manifest: not called CC=1 SCAR=6.9
Pod documented
84 0 ▶sub format() { $_[0]->{OF_format} }
Subroutine format: not called CC=1 SCAR=6.9
Pod documented
85 0 ▶sub index() { $_[0]->{OF_index} }
Subroutine index: not called CC=1 SCAR=6.9
Pod documented
86  
87 #--------------------
88  
89 sub createPages(%)
90 0 ▶{ my ($self, %args) = @_;
Subroutine createPages: not called CC=8 SCAR=42.8
Pod documented
91  
92 0 ▶ my $sel = $args{select} || sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
Condition0%0/3
$args{'select'} || sub { 1; }
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'select'} || sub { 1; }
$args{'select'} sub { 1; }
Truth table0%0/3
A || B
A= $args{'select'}B= sub { 1; }
ABresult
1X1
011
000
93 0 ▶ my $select = ref $sel eq 'CODE' ? $sel : sub { $_[0]->name =~ $sel };
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
ref $sel eq 'CODE' ? : 0 0 0
94  
95 # Manual knowledge is global
96  
97 0 ▶ my $options = $args{manual_format} || [];
Condition0%0/2
$args{'manual_format'} || []
l!l
00
MC/DC0%0/1
$args{'manual_format'} || []
$args{'manual_format'}
Truth table0%0/2
A
A= $args{'manual_format'}
Aresult
11
00
98 0 my $index = $self->index;
99  
100 0 foreach my $package (sort $index->packageNames)
101 {
102 0 foreach my $manual ($index->manualsForPackage($package))
103 0 ▶ { $select->($manual) or next;
Branch: 1 branch
BranchTrueFalseTotal
&$select($manual) or next 0 0 0
104  
105 0 ▶ unless($manual->chapters)
Branch: 1 branch
BranchTrueFalseTotal
unless ($manual->chapters) 0 0 0
106 0 { trace " skipping $manual: no chapters";
107 0 next;
108 }
109  
110 0 trace " creating manual $manual with ".(ref $self);
111  
112 $self->createManual(
113 manual => $manual,
114 template => $args{manual_templates},
115 append => $args{append},
116 0 @$options
117 );
118 }
119 }
120  
121 #
122 # Create other pages
123 #
124  
125 0 trace "creating other pages";
126 0 $self->createOtherPages(source => $args{other_templates}, process => $args{process_files});
127  
128 0 1;
129 }
130  
131  
132 0 ▶sub createManual(@) {panic}
Subroutine createManual: not called CC=1 SCAR=6.9
Pod documented
133  
134  
135 0 ▶sub cleanup($$%) { ... }
Subroutine cleanup: not called CC=1 SCAR=6.9
Pod documented
136  
137  
138 0 ▶sub cleanupString($$%) { shift->cleanup(@_) }
Subroutine cleanupString: not called CC=1 SCAR=6.9
Pod documented
139  
140  
141 sub showChapter(@)
142 0 ▶{ my ($self, %args) = @_;
Subroutine showChapter: not called CC=26 SCAR=65.5
Pod documented
143 0 ▶ my $chapter = $args{chapter} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $chapter = $args{"chapter"} or &panic() 0 0 0
144 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
145  
146 0 my $show_inh = $args{show_inherited};
147 0 ▶ my $show_ch = $args{show_inherited_chapter} || $show_inh;
Condition0%0/3
$args{'show_inherited_chapter'} || $show_inh
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'show_inherited_chapter'} || $show_inh
$args{'show_inherited_chapter'} $show_inh
Truth table0%0/3
A || B
A= $args{'show_inherited_chapter'}B= $show_inh
ABresult
1X1
011
000
148 0 ▶ my $show_sec = $args{show_inherited_section} || $show_inh;
Condition0%0/3
$args{'show_inherited_section'} || $show_inh
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'show_inherited_section'} || $show_inh
$args{'show_inherited_section'} $show_inh
Truth table0%0/3
A || B
A= $args{'show_inherited_section'}B= $show_inh
ABresult
1X1
011
000
149 0 ▶ my $show_ssec = $args{show_inherited_subsection} || $show_inh;
Condition0%0/3
$args{'show_inherited_subsection'} || $show_inh
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'show_inherited_subsection'} || $show_inh
$args{'show_inherited_subsection'} $show_inh
Truth table0%0/3
A || B
A= $args{'show_inherited_subsection'}B= $show_inh
ABresult
1X1
011
000
150 0 ▶ my $show_sssec = $args{show_inherited_subsubsection} || $show_inh;
Condition0%0/3
$args{'show_inherited_subsubsection'} || $show_inh
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'show_inherited_subsubsection'} || $show_inh
$args{'show_inherited_subsubsection'} $show_inh
Truth table0%0/3
A || B
A= $args{'show_inherited_subsubsection'}B= $show_inh
ABresult
1X1
011
000
151  
152 0 ▶ my $show_examples = $args{show_examples} || 'EXPAND';
Condition0%0/2
$args{'show_examples'} || 'EXPAND'
l!l
00
MC/DC0%0/1
$args{'show_examples'} || 'EXPAND'
$args{'show_examples'}
Truth table0%0/2
A
A= $args{'show_examples'}
Aresult
11
00
153  
154 0 ▶ if($manual->inherited($chapter))
Branch: 1 branch
BranchTrueFalseTotal
if ($manual->inherited($chapter)) 0 0 0
155 0 ▶ { return $self if $show_ch eq 'NO';
Branch: 1 branch
BranchTrueFalseTotal
if $show_ch eq "NO" 0 0 0
156 0 $self->showStructureRefer(%args, structure => $chapter);
157 0 return $self;
158 }
159  
160 $self->showStructureExpanded(%args, structure => $chapter,
161 0 ▶ show_examples => $args{show_chapter_examples} || $show_examples,
Condition0%0/3
$args{'show_chapter_examples'} || $show_examples
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'show_chapter_examples'} || $show_examples
$args{'show_chapter_examples'} $show_examples
Truth table0%0/3
A || B
A= $args{'show_chapter_examples'}B= $show_examples
ABresult
1X1
011
000
162 );
163  
164 0 foreach my $section ($chapter->sections)
165 0 ▶ { if($manual->inherited($section))
Branch: 1 branch
BranchTrueFalseTotal
if ($manual->inherited($section)) 0 0 0
166 0 ▶ { next if $show_sec eq 'NO';
Branch: 1 branch
BranchTrueFalseTotal
if $show_sec eq "NO" 0 0 0
167 0 ▶ if($show_sec ne 'REFER')
Branch: 1 branch
BranchTrueFalseTotal
if ($show_sec ne "REFER") 0 0 0
168 0 { $self->showStructureRefer(%args, structure => $section);
169 0 next;
170 }
171 }
172  
173 $self->showStructureExpanded(%args, structure => $section,
174 0 ▶ show_examples => $args{show_section_examples} || $show_examples,
Condition0%0/3
$args{'show_section_examples'} || $show_examples
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'show_section_examples'} || $show_examples
$args{'show_section_examples'} $show_examples
Truth table0%0/3
A || B
A= $args{'show_section_examples'}B= $show_examples
ABresult
1X1
011
000
175 );
176  
177 0 foreach my $subsection ($section->subsections)
178 0 ▶ { if($manual->inherited($subsection))
Branch: 1 branch
BranchTrueFalseTotal
if ($manual->inherited($subsection)) 0 0 0
179 0 ▶ { next if $show_ssec eq 'NO';
Branch: 1 branch
BranchTrueFalseTotal
if $show_ssec eq "NO" 0 0 0
180 0 ▶ if($show_ssec ne 'REFER')
Branch: 1 branch
BranchTrueFalseTotal
if ($show_ssec ne "REFER") 0 0 0
181 0 { $self->showStructureRefer(%args, structure => $subsection);
182 0 next;
183 }
184 }
185  
186 $self->showStructureExpanded(%args, structure => $subsection,
187 0 ▶ show_examples => $args{show_subsection_examples} || $show_examples,
Condition0%0/3
$args{'show_subsection_examples'} || $show_examples
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'show_subsection_examples'} || $show_examples
$args{'show_subsection_examples'} $show_examples
Truth table0%0/3
A || B
A= $args{'show_subsection_examples'}B= $show_examples
ABresult
1X1
011
000
188 );
189  
190 0 foreach my $subsubsection ($subsection->subsubsections)
191 0 ▶ { if($manual->inherited($subsubsection))
Branch: 1 branch
BranchTrueFalseTotal
if ($manual->inherited($subsubsection)) 0 0 0
192 0 ▶ { next if $show_sssec eq 'NO';
Branch: 1 branch
BranchTrueFalseTotal
if $show_sssec eq "NO" 0 0 0
193 0 ▶ if($show_sssec ne 'REFER')
Branch: 1 branch
BranchTrueFalseTotal
if ($show_sssec ne "REFER") 0 0 0
194 0 { $self->showStructureRefer(%args, structure => $subsubsection);
195 0 next;
196 }
197 }
198  
199 $self->showStructureExpanded(%args, structure => $subsubsection,
200 0 ▶ show_examples => $args{show_subsubsection_examples} || $show_examples,
Condition0%0/3
$args{'show_subsubsection_examples'} || $show_examples
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'show_subsubsection_examples'} || $show_examples
$args{'show_subsubsection_examples'} $show_examples
Truth table0%0/3
A || B
A= $args{'show_subsubsection_examples'}B= $show_examples
ABresult
1X1
011
000
201 );
202 }
203 }
204 }
205 }
206  
207  
208 0 ▶sub showStructureExpanded(@) {panic}
Subroutine showStructureExpanded: not called CC=1 SCAR=6.9
Pod documented
209  
210  
211 0 ▶sub showStructureRefer(@) {panic}
Subroutine showStructureRefer: not called CC=1 SCAR=6.9
Pod documented
212  
213 0 ▶sub chapterName(@) { $_[0]->showRequiredChapter(NAME => @_) }
Subroutine chapterName: not called CC=1 SCAR=6.9
Pod undocumented
214 0 ▶sub chapterSynopsis(@) { $_[0]->showOptionalChapter(SYNOPSIS => @_) }
Subroutine chapterSynopsis: not called CC=1 SCAR=6.9
Pod undocumented
215 0 ▶sub chapterInheritance(@) { $_[0]->showOptionalChapter(INHERITANCE => @_) }
Subroutine chapterInheritance: not called CC=1 SCAR=6.9
Pod undocumented
216 0 ▶sub chapterDescription(@) { $_[0]->showRequiredChapter(DESCRIPTION => @_) }
Subroutine chapterDescription: not called CC=1 SCAR=6.9
Pod undocumented
217 0 ▶sub chapterOverloaded(@) { $_[0]->showOptionalChapter(OVERLOADED => @_) }
Subroutine chapterOverloaded: not called CC=1 SCAR=6.9
Pod undocumented
218 0 ▶sub chapterMethods(@) { $_[0]->showOptionalChapter(METHODS => @_) }
Subroutine chapterMethods: not called CC=1 SCAR=6.9
Pod undocumented
219 0 ▶sub chapterExports(@) { $_[0]->showOptionalChapter(EXPORTS => @_) }
Subroutine chapterExports: not called CC=1 SCAR=6.9
Pod undocumented
220 0 ▶sub chapterDiagnostics(@) { $_[0]->showOptionalChapter(DIAGNOSTICS => @_) }
Subroutine chapterDiagnostics: not called CC=1 SCAR=6.9
Pod undocumented
221 0 ▶sub chapterDetails(@) { $_[0]->showOptionalChapter(DETAILS => @_) }
Subroutine chapterDetails: not called CC=1 SCAR=6.9
Pod undocumented
222 0 ▶sub chapterReferences(@) { $_[0]->showOptionalChapter(REFERENCES => @_) }
Subroutine chapterReferences: not called CC=1 SCAR=6.9
Pod undocumented
223 0 ▶sub chapterCopyrights(@) { $_[0]->showOptionalChapter(COPYRIGHTS => @_) }
Subroutine chapterCopyrights: not called CC=1 SCAR=6.9
Pod undocumented
224  
225  
226 sub showRequiredChapter($%)
227 0 ▶{ my ($self, $name, %args) = @_;
Subroutine showRequiredChapter: not called CC=3 SCAR=24.8
Pod documented
228 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
229  
230 0 ▶ my $chapter = $manual->chapter($name)
Branch: 1 branch
BranchTrueFalseTotal
my $chapter = $manual->chapter($name) or &error(&__x("missing required chapter {name} in {manual}", "name", $name, "manual", $manual)), return 0 0 0
231 or (error __x"missing required chapter {name} in {manual}", name => $name, manual => $manual), return;
232  
233 0 $self->showChapter(chapter => $chapter, %args);
234 }
235  
236  
237 sub showOptionalChapter($@)
238 0 ▶{ my ($self, $name, %args) = @_;
Subroutine showOptionalChapter: not called CC=3 SCAR=24.8
Pod documented
239 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
240 0 ▶ my $chapter = $manual->chapter($name) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $chapter = $manual->chapter($name) or return 0 0 0
241 0 $self->showChapter(chapter => $chapter, %args);
242 }
243  
244  
245 0 ▶sub createOtherPages(@) { $_[0] }
Subroutine createOtherPages: not called CC=1 SCAR=6.9
Pod documented
246  
247  
248 sub showSubroutines(@)
249 0 ▶{ my ($self, %args) = @_;
Subroutine showSubroutines: not called CC=15 SCAR=54.8
Pod documented
250  
251 0 ▶ my @subs = $args{subroutines} ? sort @{$args{subroutines}} : [];
Branch: 1 branch
BranchTrueFalseTotal
$args{'subroutines'} ? : 0 0 0
252 0 ▶ @subs or return $self;
Branch: 1 branch
BranchTrueFalseTotal
@subs or return $self 0 0 0
253  
254 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
255 0 ▶ my $output = $args{output} || select;
Condition0%0/3
$args{'output'} || select()
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'output'} || select()
$args{'output'} select()
Truth table0%0/3
A || B
A= $args{'output'}B= select()
ABresult
1X1
011
000
256  
257 # list is also in ::Pod3
258 0 ▶ $args{show_described_options} ||= 'EXPAND';
Condition0%0/2
$args{"show_described_options"} ||= "EXPAND"
l!l
00
MC/DC0%0/1
$args{"show_described_options"} ||= "EXPAND"
$args{"show_described_options"}
Truth table0%0/2
A
A= $args{"show_described_options"}
Aresult
11
00
259 0 ▶ $args{show_described_subs} ||= 'EXPAND';
Condition0%0/2
$args{"show_described_subs"} ||= "EXPAND"
l!l
00
MC/DC0%0/1
$args{"show_described_subs"} ||= "EXPAND"
$args{"show_described_subs"}
Truth table0%0/2
A
A= $args{"show_described_subs"}
Aresult
11
00
260 0 ▶ $args{show_diagnostics} ||= 'NO';
Condition0%0/2
$args{"show_diagnostics"} ||= "NO"
l!l
00
MC/DC0%0/1
$args{"show_diagnostics"} ||= "NO"
$args{"show_diagnostics"}
Truth table0%0/2
A
A= $args{"show_diagnostics"}
Aresult
11
00
261 0 ▶ $args{show_examples} ||= 'EXPAND';
Condition0%0/2
$args{"show_examples"} ||= "EXPAND"
l!l
00
MC/DC0%0/1
$args{"show_examples"} ||= "EXPAND"
$args{"show_examples"}
Truth table0%0/2
A
A= $args{"show_examples"}
Aresult
11
00
262 0 ▶ $args{show_inherited_options} ||= 'USE';
Condition0%0/2
$args{"show_inherited_options"} ||= "USE"
l!l
00
MC/DC0%0/1
$args{"show_inherited_options"} ||= "USE"
$args{"show_inherited_options"}
Truth table0%0/2
A
A= $args{"show_inherited_options"}
Aresult
11
00
263 0 ▶ $args{show_inherited_subs} ||= 'USE';
Condition0%0/2
$args{"show_inherited_subs"} ||= "USE"
l!l
00
MC/DC0%0/1
$args{"show_inherited_subs"} ||= "USE"
$args{"show_inherited_subs"}
Truth table0%0/2
A
A= $args{"show_inherited_subs"}
Aresult
11
00
264 0 ▶ $args{show_option_table} ||= 'ALL';
Condition0%0/2
$args{"show_option_table"} ||= "ALL"
l!l
00
MC/DC0%0/1
$args{"show_option_table"} ||= "ALL"
$args{"show_option_table"}
Truth table0%0/2
A
A= $args{"show_option_table"}
Aresult
11
00
265 0 ▶ $args{show_subs_index} ||= 'NO';
Condition0%0/2
$args{"show_subs_index"} ||= "NO"
l!l
00
MC/DC0%0/1
$args{"show_subs_index"} ||= "NO"
$args{"show_subs_index"}
Truth table0%0/2
A
A= $args{"show_subs_index"}
Aresult
11
00
266  
267 0 $self->showSubsIndex(%args, subroutines => \@subs);
268  
269 0 ▶ for(my $index=0; $index<@subs; $index++)
Branch: 1 branch
BranchTrueFalseTotal
if ($index < @subs) 0 0 0
270 0 { my $subroutine = $subs[$index];
271 0 ▶ my $show = $manual->inherited($subroutine) ? $args{show_inherited_subs} : $args{show_described_subs};
Branch: 1 branch
BranchTrueFalseTotal
$manual->inherited($subroutine) ? : 0 0 0
272  
273 0 $self->showSubroutine(
274 %args,
275 subroutine => $subroutine,
276 show_subroutine => $show,
277 last => ($index==$#subs),
278 );
279 }
280 }
281  
282  
283 sub showSubroutine(@)
284 0 ▶{ my ($self, %args) = @_;
Subroutine showSubroutine: not called CC=39 SCAR=73.5
Pod documented
285  
286 0 ▶ my $subroutine = $args{subroutine} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $subroutine = $args{"subroutine"} or &panic() 0 0 0
287 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
288 0 ▶ my $output = $args{output} || select;
Condition0%0/3
$args{'output'} || select()
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'output'} || select()
$args{'output'} select()
Truth table0%0/3
A || B
A= $args{'output'}B= select()
ABresult
1X1
011
000
289  
290 #
291 # Method use
292 #
293  
294 0 ▶ my $use = $args{show_subroutine} || 'EXPAND';
Condition0%0/2
$args{'show_subroutine'} || 'EXPAND'
l!l
00
MC/DC0%0/1
$args{'show_subroutine'} || 'EXPAND'
$args{'show_subroutine'}
Truth table0%0/2
A
A= $args{'show_subroutine'}
Aresult
11
00
295 0 ▶ my ($show_use, $expand)
Branch: 4 branches
BranchTrueFalseTotal
$use eq 'EXPAND' ? : 0 0 0
$use eq 'USE' ? : 0 0 0
$use eq 'NAMES' ? : 0 0 0
$use eq 'NO' ? : 0 0 0
296 = $use eq 'EXPAND' ? ('showSubroutineUse', 1)
297 : $use eq 'USE' ? ('showSubroutineUse', 0)
298 : $use eq 'NAMES' ? ('showSubroutineName', 0)
299 : $use eq 'NO' ? (undef, 0)
300 : error __x"illegal value for show_subroutine: {value}", value => $use;
301  
302 0 ▶ $self->$show_use(%args, subroutine => $subroutine)
Branch: 1 branch
BranchTrueFalseTotal
if defined $show_use 0 0 0
303 if defined $show_use;
304  
305 0 ▶ $expand or return;
Branch: 1 branch
BranchTrueFalseTotal
$expand or return 0 0 0
306  
307 0 ▶ $args{show_inherited_options} ||= 'USE';
Condition0%0/2
$args{"show_inherited_options"} ||= "USE"
l!l
00
MC/DC0%0/1
$args{"show_inherited_options"} ||= "USE"
$args{"show_inherited_options"}
Truth table0%0/2
A
A= $args{"show_inherited_options"}
Aresult
11
00
308 0 ▶ $args{show_described_options} ||= 'EXPAND';
Condition0%0/2
$args{"show_described_options"} ||= "EXPAND"
l!l
00
MC/DC0%0/1
$args{"show_described_options"} ||= "EXPAND"
$args{"show_described_options"}
Truth table0%0/2
A
A= $args{"show_described_options"}
Aresult
11
00
309  
310 #
311 # Subroutine descriptions
312 #
313  
314 0 ▶ my $descr = $args{show_sub_description} || 'DESCRIBED';
Condition0%0/2
$args{'show_sub_description'} || 'DESCRIBED'
l!l
00
MC/DC0%0/1
$args{'show_sub_description'} || 'DESCRIBED'
$args{'show_sub_description'}
Truth table0%0/2
A
A= $args{'show_sub_description'}
Aresult
11
00
315 0 my $description = $subroutine->findDescriptionObject;
316 0 my $show_descr = 'showSubroutineDescription';
317  
318 0 ▶ if($descr eq 'NO') { $show_descr = undef }
Branch: 4 branches
BranchTrueFalseTotal
if ($descr eq 'NO') { } 0 0 0
elsif ($descr eq 'REFER') { } 0 0 0
elsif ($descr eq 'DESCRIBED') { } 0 0 0
elsif ($descr eq 'ALL') { } 0 0 0
319 elsif($descr eq 'REFER')
320 0 ▶ { $show_descr = 'showSubroutineDescriptionRefer'
Branch: 1 branch
BranchTrueFalseTotal
if $description and $manual->inherited($description) 0 0 0
Condition0%0/3
$description and $manual->inherited($description)
!ll&&!rl&&r
000
MC/DC0%0/2
$description and $manual->inherited($description)
$description $manual->inherited($description)
Truth table0%0/3
A and B
A= $descriptionB= $manual->inherited($description)
ABresult
0X0
100
111
321 if $description && $manual->inherited($description);
322 }
323 elsif($descr eq 'DESCRIBED')
324 0 ▶ { $show_descr = 'showSubroutineDescriptionRefer'
Branch: 1 branch
BranchTrueFalseTotal
if $description and $manual->inherited($description) 0 0 0
Condition0%0/3
$description and $manual->inherited($description)
!ll&&!rl&&r
000
MC/DC0%0/2
$description and $manual->inherited($description)
$description $manual->inherited($description)
Truth table0%0/3
A and B
A= $descriptionB= $manual->inherited($description)
ABresult
0X0
100
111
325 if $description && $manual->inherited($description);
326 }
327 elsif($descr eq 'ALL') {;}
328 0 else { error __x"illegal value for show_sub_description: {value}", value => $descr}
329  
330 0 ▶ $self->$show_descr(%args, subroutine => $description // $subroutine)
Branch: 1 branch
BranchTrueFalseTotal
if defined $show_descr 0 0 0
Condition0%0/3
$description // $subroutine
l!l&&r!l&&!r
000
MC/DC0%0/2
$description // $subroutine
$description $subroutine
Truth table0%0/3
A // B
A= $descriptionB= $subroutine
ABresult
1X1
011
000
331 if defined $show_descr;
332  
333 #
334 # Options
335 #
336  
337 0 my $options = $subroutine->collectedOptions;
338  
339 0 ▶ my $opttab = $args{show_option_table} || 'NAMES';
Condition0%0/2
$args{'show_option_table'} || 'NAMES'
l!l
00
MC/DC0%0/1
$args{'show_option_table'} || 'NAMES'
$args{'show_option_table'}
Truth table0%0/2
A
A= $args{'show_option_table'}
Aresult
11
00
340 0 my @options = @{$options}{ sort keys %$options };
341  
342 # Option table
343  
344 my @opttab
345 0 ▶ = $opttab eq 'NO' ? ()
Branch: 4 branches
BranchTrueFalseTotal
$opttab eq 'NO' ? : 0 0 0
$opttab eq 'DESCRIBED' ? : 0 0 0
$opttab eq 'INHERITED' ? : 0 0 0
$opttab eq 'ALL' ? : 0 0 0
346 : $opttab eq 'DESCRIBED'? (grep not $manual->inherits($_->[0]), @options)
347 : $opttab eq 'INHERITED'? (grep $manual->inherits($_->[0]), @options)
348 : $opttab eq 'ALL' ? @options
349 : error __x"illegal value for show_option_table: {value}", value => $opttab;
350  
351 0 ▶ $self->showOptionTable(%args, options => \@opttab) if @opttab;
Branch: 1 branch
BranchTrueFalseTotal
if @opttab 0 0 0
352  
353 # Option expanded
354  
355 0 my @optlist;
356 0 foreach (@options)
357 0 { my ($option, $default) = @$_;
358 0 ▶ my $check = $manual->inherited($option) ? $args{show_inherited_options} : $args{show_described_options};
Branch: 1 branch
BranchTrueFalseTotal
$manual->inherited($option) ? : 0 0 0
359 0 ▶ push @optlist, $_ if $check eq 'USE' || $check eq 'EXPAND';
Branch: 1 branch
BranchTrueFalseTotal
if $check eq "USE" or $check eq "EXPAND" 0 0 0
Condition0%0/3
$check eq "USE" or $check eq "EXPAND"
l!l&&r!l&&!r
000
MC/DC0%0/2
$check eq "USE" or $check eq "EXPAND"
$check eq "USE" $check eq "EXPAND"
Truth table0%0/3
A or B
A= $check eq "USE"B= $check eq "EXPAND"
ABresult
1X1
011
000
360 }
361  
362 0 ▶ $self->showOptions(%args, options => \@optlist)
Branch: 1 branch
BranchTrueFalseTotal
if @optlist 0 0 0
363 if @optlist;
364  
365 # Examples
366  
367 0 my @examples = $subroutine->examples;
368 0 ▶ my $show_ex = $args{show_examples} || 'EXPAND';
Condition0%0/2
$args{'show_examples'} || 'EXPAND'
l!l
00
MC/DC0%0/1
$args{'show_examples'} || 'EXPAND'
$args{'show_examples'}
Truth table0%0/2
A
A= $args{'show_examples'}
Aresult
11
00
369 0 ▶ $self->showExamples(%args, examples => \@examples)
Branch: 1 branch
BranchTrueFalseTotal
if $show_ex eq "EXPAND" 0 0 0
370 if $show_ex eq 'EXPAND';
371  
372 # Diagnostics
373  
374 0 my @diags = $subroutine->diagnostics;
375 0 ▶ my $show_diag= $args{show_diagnostics} || 'NO';
Condition0%0/2
$args{'show_diagnostics'} || 'NO'
l!l
00
MC/DC0%0/1
$args{'show_diagnostics'} || 'NO'
$args{'show_diagnostics'}
Truth table0%0/2
A
A= $args{'show_diagnostics'}
Aresult
11
00
376 0 ▶ $self->showDiagnostics(%args, diagnostics => \@diags)
Branch: 1 branch
BranchTrueFalseTotal
if $show_diag eq "EXPAND" 0 0 0
377 if $show_diag eq 'EXPAND';
378 }
379  
380  
381 0 ▶sub showExamples(@) { $_[0] }
Subroutine showExamples: not called CC=1 SCAR=6.9
Pod documented
382  
383  
384 0 ▶sub showSubroutineUse(@) { $_[0] }
Subroutine showSubroutineUse: not called CC=1 SCAR=6.9
Pod documented
385  
386  
387 0 ▶sub showSubroutineName(@) { $_[0] }
Subroutine showSubroutineName: not called CC=1 SCAR=6.9
Pod documented
388  
389  
390 0 ▶sub showSubroutineDescription(@) { $_[0] }
Subroutine showSubroutineDescription: not called CC=1 SCAR=6.9
Pod documented
391  
392  
393 sub showOptionTable(@)
394 0 ▶{ my ($self, %args) = @_;
Subroutine showOptionTable: not called CC=8 SCAR=42.8
Pod documented
395 0 ▶ my $options = $args{options} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $options = $args{"options"} or &panic() 0 0 0
396 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
397 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
398  
399 0 my @rows;
400 0 foreach (@$options)
401 0 { my ($option, $default) = @$_;
402 0 my $optman = $option->manual;
403 0 ▶ push @rows, [
Branch: 1 branch
BranchTrueFalseTotal
$manual->inherited($option) ? : 0 0 0
404 $self->cleanupString($manual, $option->name, tag => 'option_name'),
405 ($manual->inherited($option) ? $self->link(undef, $optman) : ''),
406 $self->cleanupString($manual, $default->value, tag => 'option_default'),
407 ];
408 }
409  
410 0 my @header = ('Option', 'Defined in', 'Default');
411 0 ▶ unless(grep length $_->[1], @rows)
Branch: 1 branch
BranchTrueFalseTotal
unless (grep length($_->[1]), @rows) 0 0 0
412 { # removed empty "defined in" column
413 0 splice @$_, 1, 1 for @rows, \@header;
414 }
415  
416 0 $output->print("\n");
417 0 $self->writeTable(output => $output, header => \@header, rows => \@rows, widths => [undef, 15, undef]);
418 0 $self;
419 }
420  
421  
422 sub showOptions(@)
423 0 ▶{ my ($self, %args) = @_;
Subroutine showOptions: not called CC=7 SCAR=40.3
Pod documented
424  
425 0 ▶ my $options = $args{options} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $options = $args{"options"} or &panic() 0 0 0
426 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
427  
428 0 foreach (@$options)
429 0 { my ($option, $default) = @$_;
430 0 ▶ my $show = $manual->inherited($option) ? $args{show_inherited_options} : $args{show_described_options};
Branch: 1 branch
BranchTrueFalseTotal
$manual->inherited($option) ? : 0 0 0
431  
432 0 ▶ my $action
Branch: 2 branches
BranchTrueFalseTotal
$show eq 'USE' ? : 0 0 0
$show eq 'EXPAND' ? : 0 0 0
433 = $show eq 'USE' ? 'showOptionUse'
434 : $show eq 'EXPAND'? 'showOptionExpand'
435 : error __x"illegal show option choice: {value}", value => $show;
436  
437 0 $self->$action(%args, option => $option, default => $default);
438 }
439 0 $self;
440 }
441  
442  
443 0 ▶sub showOptionUse(@) { $_[0] }
Subroutine showOptionUse: not called CC=1 SCAR=6.9
Pod documented
444  
445  
446 0 ▶sub showOptionExpand(@) { $_[0] }
Subroutine showOptionExpand: not called CC=1 SCAR=6.9
Pod documented
447  
448 2 1;
↑ Summary lib/OODoc.pm »