lib/OODoc/Parser/Markov.pm

filter: Statementstmt 11.5% 55 / 478 Branchbran 0.0% 0 / 266 Conditioncond 0.0% 0 / 128 MC/DCmcdc 0.0% 0 / 74 Subroutinesub 25.8% 16 / 62 Podpod 50.0% 20 / 40 totaltotal 8.6% 91 / 1048 CC 190 SCAR 55.0
CC
190
Cov
6%
parse
702.0
cleanupPod
650.0
decomposeL
420.0
CRAP 244.9
« lib/OODoc/Format/Html.pm ↑ Summary lib/OODoc/Text/Subroutine.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::Parser::Markov;{
13 1 our $VERSION = '3.05';
14 }
15  
16 1 ▶use parent 'OODoc::Parser';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Log::Report 'oodoc';
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 ▶use OODoc::Text::Chapter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use OODoc::Text::Section ();
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use OODoc::Text::SubSection ();
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use OODoc::Text::SubSubSection ();
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use OODoc::Text::Subroutine ();
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶use OODoc::Text::Option ();
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 ▶use OODoc::Text::Default ();
Subroutine BEGIN: called CC=1 SCAR=0.0
30 1 ▶use OODoc::Text::Diagnostic ();
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 ▶use OODoc::Text::Example ();
Subroutine BEGIN: called CC=1 SCAR=0.0
32 1 ▶use OODoc::Manual ();
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 1 ▶use File::Spec ();
Subroutine BEGIN: called CC=1 SCAR=0.0
35 1 ▶use Scalar::Util qw/blessed weaken/;
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 1 my $url_modsearch = 'https://metacpan.org/dist/';
38 1 my $url_coderoot = 'CODE';
39 1 my @default_rules;
40  
41 #--------------------
42  
43 sub init($)
44 0 ▶{ my ($self, $args) = @_;
Subroutine init: not called CC=5 SCAR=34.0
Pod undocumented
45 0 ▶ $self->SUPER::init($args) or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init($args) or return 0 0 0
46  
47 0 my @rules = @default_rules;
48 0 unshift @rules, @{delete $args->{additional_rules}}
49 0 ▶ if exists $args->{additional_rules};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"additional_rules"} 0 0 0
50  
51 0 $self->{OPM_rules} = [];
52 0 $self->rule(@$_) for @rules;
53  
54 0 ▶ $self->{OPM_index} = delete $args->{index} or panic;
Branch: 1 branch
BranchTrueFalseTotal
$self->{"OPM_index"} = delete $args->{"index"} or &panic() 0 0 0
55 0 weaken($self->{OPM_index});
56  
57 0 $self;
58 }
59  
60 #--------------------
61  
62 sub setBlock($)
63 0 ▶{ my ($self, $ref) = @_;
Subroutine setBlock: not called CC=1 SCAR=6.9
Pod documented
64 0 $self->{OPM_block} = $ref;
65 0 $self->inDoc(1);
66 0 $ref;
67 }
68  
69  
70 0 ▶sub inDoc(;$) { my $s = shift; @_ ? ($s->{OPM_in_pod} = shift) : $s->{OPM_in_pod} }
Subroutine inDoc: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
71  
72  
73 0 ▶sub currentManual(;$) { my $s = shift; @_ ? ($s->{OPM_manual} = shift) : $s->{OPM_manual} }
Subroutine currentManual: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
74  
75  
76 0 ▶sub rules() { $_[0]->{OPM_rules} }
Subroutine rules: not called CC=1 SCAR=6.9
Pod documented
77  
78  
79 0 ▶sub index() { $_[0]->{OPM_index} }
Subroutine index: not called CC=1 SCAR=6.9
Pod documented
80  
81 #--------------------
82  
83 1 @default_rules =
84 ( [ '=cut' => 'docCut' ],
85 [ '=chapter' => 'docChapter' ],
86 [ '=section' => 'docSection' ],
87 [ '=subsection' => 'docSubSection' ],
88 [ '=subsubsection' => 'docSubSubSection' ],
89  
90 [ '=method' => 'docSubroutine' ],
91 [ '=i_method' => 'docSubroutine' ],
92 [ '=c_method' => 'docSubroutine' ],
93 [ '=ci_method' => 'docSubroutine' ],
94 [ '=function' => 'docSubroutine' ],
95 [ '=tie' => 'docSubroutine' ],
96 [ '=overload' => 'docSubroutine' ],
97  
98 [ '=option' => 'docOption' ],
99 [ '=default' => 'docDefault' ],
100 [ '=requires' => 'docRequires' ],
101 [ '=example' => 'docExample' ],
102 [ '=examples' => 'docExample' ],
103  
104 [ '=alert' => 'docDiagnostic' ],
105 [ '=debug' => 'docDiagnostic' ],
106 [ '=error' => 'docDiagnostic' ],
107 [ '=fault' => 'docDiagnostic' ],
108 [ '=info' => 'docDiagnostic' ],
109 [ '=notice' => 'docDiagnostic' ],
110 [ '=warning' => 'docDiagnostic' ],
111  
112 # deprecated
113 [ '=head1' => 'docChapter' ],
114 [ '=head2' => 'docSection' ],
115 [ '=head3' => 'docSubSection' ],
116 [ '=head4' => 'docSubSubSection' ],
117  
118 # problem spotter
119 [ qr/^(warn|die|carp|confess|croak)\s/ => 'debugRemains' ],
120 [ qr/^( sub \s+ \w
121 | (?:my|our) \s+ [\($@%]
122 | (?:package|use) \s+ \w+\:
123 )
124 /x => 'forgotCut' ]
125 );
126  
127  
128 sub rule($$)
129 0 ▶{ my ($self, $match, $action) = @_;
Subroutine rule: not called CC=1 SCAR=6.9
Pod documented
130 0 push @{$self->rules}, +[ $match, $action ];
131 0 $self;
132 }
133  
134  
135 sub findMatchingRule($)
136 0 ▶{ my ($self, $line) = @_;
Subroutine findMatchingRule: not called CC=5 SCAR=34.0
Pod documented
137  
138 0 foreach ( @{$self->rules} )
139 0 { my ($match, $action) = @$_;
140 0 ▶ if(ref $match)
Branch: 2 branches
BranchTrueFalseTotal
if (ref $match) { } 0 0 0
elsif (substr($line, 0, length $match) eq $match) { } 0 0 0
141 0 ▶ { return ($&, $action) if $line =~ $match;
Branch: 1 branch
BranchTrueFalseTotal
if $line =~ /$match/ 0 0 0
142 }
143 elsif(substr($line, 0, length($match)) eq $match)
144 0 { return ($match, $action);
145 }
146 }
147  
148 0 ();
149 }
150  
151  
152 sub parse(@)
153 0 ▶{ my ($self, %args) = @_;
Subroutine parse: not called CC=26 SCAR=65.5
Pod documented
154  
155 my $input = $args{input}
156 0 ▶ or error __x"no input file to parse specified";
Branch: 1 branch
BranchTrueFalseTotal
my $input = $args{"input"} or &error(&__x("no input file to parse specified")) 0 0 0
157  
158 0 ▶ my $output = $args{output} || File::Spec->devnull;
Condition0%0/3
$args{'output'} || 'File::Spec'->devnull
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'output'} || 'File::Spec'->devnull
$args{'output'} 'File::Spec'->devnull
Truth table0%0/3
A || B
A= $args{'output'}B= 'File::Spec'->devnull
ABresult
1X1
011
000
159 0 ▶ my $version = $args{version} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $version = $args{"version"} or &panic() 0 0 0
160 0 ▶ my $distr = $args{distribution} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $distr = $args{"distribution"} or &panic() 0 0 0
161  
162 0 ▶ open my $in, '<:encoding(UTF-8)', $input
Branch: 1 branch
BranchTrueFalseTotal
open my $in, "<:encoding(UTF-8)", $input or &fault(&__x("cannot read document from {file}", "file", $input)) 0 0 0
163 or fault __x"cannot read document from {file}", file => $input;
164  
165 0 ▶ open my $out, '>:encoding(UTF-8)', $output
Branch: 1 branch
BranchTrueFalseTotal
open my $out, ">:encoding(UTF-8)", $output or &fault(&__x("cannot write stripped code to {file}", "file", $output)) 0 0 0
166 or fault __x"cannot write stripped code to {file}", file => $output;
167  
168 # pure doc files have no package statement included, so it shall
169 # be created beforehand.
170  
171 0 my ($manual, @manuals);
172  
173 0 my $pure_pod = $input =~ m/\.pod$/;
174 0 ▶ if($pure_pod)
Branch: 1 branch
BranchTrueFalseTotal
if ($pure_pod) { } 0 0 0
175 0 { $manual = OODoc::Manual->new(
176 package => $self->filenameToPackage($input),
177 pure_pod => 1,
178 source => $input,
179 parser => $self,
180 distribution => $distr,
181 version => $version,
182 index => $self->index,
183 );
184  
185 0 push @manuals, $manual;
186 0 $self->currentManual($manual);
187 0 $self->inDoc(1);
188 }
189 else
190 0 ▶ { $out->print($args{notice}) if $args{notice};
Branch: 1 branch
BranchTrueFalseTotal
if $args{"notice"} 0 0 0
191 0 $self->inDoc(0);
192 }
193  
194 # Read through the file.
195  
196 0 ▶ while(my $line = $in->getline)
Branch: 1 branch
BranchTrueFalseTotal
if (my $line = $in->getline) 0 0 0
197 0 { my $ln = $in->input_line_number;
198  
199 0 ▶ if( !$self->inDoc
Branch: 7 branches
BranchTrueFalseTotal
if (not $self->inDoc || $line =~ /^\s*package\s*DB\s*;/ and $line =~ s/^(\s*package\s*([\w\-\:]+)\s*\;)//) { } 0 0 0
elsif (not $self->inDoc and $line =~ /^=package\s*([\w\-\:]+)\s*$/) { } 0 0 0
elsif (() = $self->findMatchingRule($line)) { } 0 0 0
elsif ($line =~ /^=(over|back|item|for|pod|begin|end|encoding)\b/) { } 0 0 0
elsif (substr($line, 0, 1) eq '=') { } 0 0 0
elsif ($pure_pod or $self->inDoc) { } 0 0 0
elsif ($line eq "__DATA__\n") { } 0 0 0
Condition0%0/6
not $self->inDoc || $line =~ /^\s*package\s*DB\s*;/ and $line =~ s/^(\s*package\s*([\w\-\:]+)\s*\;)//
!ll&&!rl&&r
000
$self->inDoc || $line =~ /^\s*package\s*DB\s*;/
l!l&&r!l&&!r
000
MC/DC0%0/3
not $self->inDoc || $line =~ /^\s*package\s*DB\s*;/ and $line =~ s/^(\s*package\s*([\w\-\:]+)\s*\;)//
$self->inDoc $line =~ /^\s*package\s*DB\s*;/ $line =~ s/^(\s*package\s*([\w\-\:]+)\s*\;)//
Truth table0%0/4
not(A || B) and C
A= $self->inDocB= $line =~ /^\s*package\s*DB\s*;/C= $line =~ s/^(\s*package\s*([\w\-\:]+)\s*\;)//
ABCresult
1XX0
01X0
0000
0011
200 && $line !~ m/^\s*package\s*DB\s*;/
201 && $line =~ s/^(\s*package\s*([\w\-\:]+)\s*\;)//
202 )
203 0 { $out->print($1);
204 0 my $package = $2;
205  
206 # Wrap VERSION declaration in a block to avoid any problems with
207 # double declaration
208 0 $out->print("{\nour \$VERSION = '$version';\n}\n");
209 0 $out->print($line);
210  
211 0 $manual = OODoc::Manual->new(
212 package => $package,
213 source => $input,
214 stripped => $output,
215 parser => $self,
216 index => $self->index,
217  
218 distribution => $distr,
219 version => $version,
220 );
221 0 push @manuals, $manual;
222 0 $self->currentManual($manual);
223 }
224 ▶ elsif(!$self->inDoc && $line =~ m/^=package\s*([\w\-\:]+)\s*$/)
Condition0%0/3
not $self->inDoc and $line =~ /^=package\s*([\w\-\:]+)\s*$/
!ll&&!rl&&r
000
MC/DC0%0/2
not $self->inDoc and $line =~ /^=package\s*([\w\-\:]+)\s*$/
not $self->inDoc $line =~ /^=package\s*([\w\-\:]+)\s*$/
Truth table0%0/3
not(A) and B
A= not $self->inDocB= $line =~ /^=package\s*([\w\-\:]+)\s*$/
ABresult
0X0
100
111
225 0 { my $package = $1;
226 0 $manual = OODoc::Manual->new(
227 package => $package,
228 source => $input,
229 stripped => $output,
230 parser => $self,
231 distribution => $distr,
232 version => $version,
233 index => $self->index,
234 );
235 0 push @manuals, $manual;
236 0 $self->currentManual($manual);
237 }
238 elsif(my($match, $action) = $self->findMatchingRule($line))
239 0 ▶ { $self->$action($match, $line, $input, $ln)
Branch: 1 branch
BranchTrueFalseTotal
$self->$action($match, $line, $input, $ln) or $out->print($line) 0 0 0
240 or $out->print($line);
241 }
242 elsif($line =~ m/^=(over|back|item|for|pod|begin|end|encoding)\b/)
243 0 { ${$self->{OPM_block}} .= "\n". $line;
244 0 $self->inDoc(1);
245 }
246 elsif(substr($line, 0, 1) eq '=')
247 0 { warning __x"unknown markup in {file} line {linenr}:\n {line}", file => $input, linenr => $ln, line => $line;
248 0 ${$self->{OPM_block}} .= $line;
249 0 $self->inDoc(1);
250 }
251 ▶ elsif($pure_pod || $self->inDoc)
Condition0%0/3
$pure_pod or $self->inDoc
l!l&&r!l&&!r
000
MC/DC0%0/2
$pure_pod or $self->inDoc
$pure_pod $self->inDoc
Truth table0%0/3
A or B
A= $pure_podB= $self->inDoc
ABresult
1X1
011
000
252 { # add the line to the currently open text block
253 0 my $block = $self->{OPM_block};
254 0 ▶ unless($block)
Branch: 1 branch
BranchTrueFalseTotal
unless ($block) 0 0 0
255 0 { warning __x"no block for line {linenr} in file {file}\n {line}", file => $input, linenr => $ln, line => $line;
256 0 my $dummy = '';
257 0 $block = $self->setBlock(\$dummy);
258 }
259 0 $$block .= $line;
260 }
261 elsif($line eq "__DATA__\n") # flush rest file
262 0 { $out->print($line, $in->getlines);
263 }
264 else
265 0 { $out->print($line);
266 }
267 }
268  
269 0 ▶ ! $self->inDoc || $pure_pod
Branch: 1 branch
BranchTrueFalseTotal
not $self->inDoc or $pure_pod or &warning(&__x("doc did not end in {file}", "file", $input)) 0 0 0
Condition0%0/3
not $self->inDoc or $pure_pod
l!l&&r!l&&!r
000
MC/DC0%0/2
not $self->inDoc or $pure_pod
not $self->inDoc $pure_pod
Truth table0%0/3
not(A) or B
A= not $self->inDocB= $pure_pod
ABresult
1X1
011
000
270 or warning __x"doc did not end in {file}", file => $input;
271  
272 0 $self->closeChapter;
273 0 ▶ $in->close && $out->close;
Branch: 1 branch
BranchTrueFalseTotal
$in->close and $out->close 0 0 0
274  
275 0 @manuals;
276 }
277  
278  
279 sub docCut($$$$)
280 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine docCut: not called CC=3 SCAR=24.8
Pod undocumented
281  
282 0 ▶ if($self->currentManual->isPurePod)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->currentManual->isPurePod) 0 0 0
283 0 { warn "The whole file $fn is pod, so =cut in line $ln is useless.\n";
284 0 return;
285 }
286  
287 $self->inDoc
288 0 ▶ or warning __x"Pod tag {tag} does not terminate any doc in {file} line {line}", tag => $match, file => $fn, line => $ln;
Branch: 1 branch
BranchTrueFalseTotal
$self->inDoc or &warning(&__x("Pod tag {tag} does not terminate any doc in {file} line {line}", "tag", $match, "file", $fn, "line", $ln)) 0 0 0
289  
290 0 $self->inDoc(0);
291 0 1;
292 }
293  
294 # CHAPTER
295  
296  
297 sub docChapter($$$$)
298 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine docChapter: not called CC=2 SCAR=17.9
Pod undocumented
299 0 $line =~ s/^\=(chapter|head1)\s+//;
300 0 $line =~ s/\s+$//;
301  
302 0 $self->closeChapter;
303  
304 0 ▶ my $manual = $self->currentManual
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $self->currentManual or &error(&__x("chapter {name} before package statement in {file} line {line}", "name", $line, "file", $fn, "line", $ln)) 0 0 0
305 or error __x"chapter {name} before package statement in {file} line {line}", name => $line, file => $fn, line => $ln;
306  
307 my $chapter = $self->{OPM_chapter} =
308 0 OODoc::Text::Chapter->new(name => $line, manual => $manual, linenr => $ln);
309  
310 0 $self->setBlock($chapter->openDescription);
311 0 $manual->chapter($chapter);
312 0 $chapter;
313 }
314  
315 sub closeChapter()
316 0 ▶{ my $self = shift;
Subroutine closeChapter: not called CC=2 SCAR=17.9
Pod undocumented
317 0 ▶ my $chapter = delete $self->{OPM_chapter} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $chapter = delete $self->{"OPM_chapter"} or return 0 0 0
318 0 $self->closeSection->closeSubroutine;
319 }
320  
321 # SECTION
322  
323  
324 sub docSection($$$$)
325 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine docSection: not called CC=2 SCAR=17.9
Pod undocumented
326 0 $line =~ s/^\=(section|head2)\s+//;
327 0 $line =~ s/\s+$//;
328  
329 0 $self->closeSection;
330  
331 my $chapter = $self->{OPM_chapter}
332 0 ▶ or error __x"section '{name}' outside chapter in {file} line {line}", name => $line, file => $fn, line => $ln;
Branch: 1 branch
BranchTrueFalseTotal
my $chapter = $self->{"OPM_chapter"} or &error(&__x("section '{name}' outside chapter in {file} line {line}", "name", $line, "file", $fn, "line", $ln)) 0 0 0
333  
334 my $section = $self->{OPM_section} =
335 0 OODoc::Text::Section->new(name => $line, chapter => $chapter, linenr => $ln);
336  
337 0 $chapter->section($section);
338 0 $self->setBlock($section->openDescription);
339 0 $section;
340 }
341  
342 sub closeSection()
343 0 ▶{ my $self = shift;
Subroutine closeSection: not called CC=2 SCAR=17.9
Pod undocumented
344 0 ▶ my $section = delete $self->{OPM_section} or return $self;
Branch: 1 branch
BranchTrueFalseTotal
my $section = delete $self->{"OPM_section"} or return $self 0 0 0
345 0 $self->closeSubSection;
346 }
347  
348 # SUBSECTION
349  
350  
351 sub docSubSection($$$$)
352 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine docSubSection: not called CC=2 SCAR=17.9
Pod undocumented
353 0 $line =~ s/^\=(subsection|head3)\s+//;
354 0 $line =~ s/\s+$//;
355  
356 0 $self->closeSubSection;
357  
358 my $section = $self->{OPM_section}
359 0 ▶ or error __x"subsection '{name}' outside section in {file} line {line}", name => $line, file => $fn, line => $ln;
Branch: 1 branch
BranchTrueFalseTotal
my $section = $self->{"OPM_section"} or &error(&__x("subsection '{name}' outside section in {file} line {line}", "name", $line, "file", $fn, "line", $ln)) 0 0 0
360  
361 my $subsection = $self->{OPM_subsection} =
362 0 OODoc::Text::SubSection->new(name => $line, section => $section, linenr => $ln);
363  
364 0 $section->subsection($subsection);
365 0 $self->setBlock($subsection->openDescription);
366 0 $subsection;
367 }
368  
369 sub closeSubSection()
370 0 ▶{ my $self = shift;
Subroutine closeSubSection: not called CC=1 SCAR=6.9
Pod undocumented
371 0 my $subsection = delete $self->{OPM_subsection};
372 0 $self->closeSubSubSection;
373 }
374  
375 # SUBSECTION
376  
377  
378 sub docSubSubSection($$$$)
379 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine docSubSubSection: not called CC=2 SCAR=17.9
Pod undocumented
380 0 $line =~ s/^\=(subsubsection|head4)\s+//;
381 0 $line =~ s/\s+$//;
382  
383 0 $self->closeSubSubSection;
384  
385 my $subsection = $self->{OPM_subsection}
386 0 ▶ or error __x"subsubsection '{name}' outside section in {file} line {line}", name => $line, file => $fn, line => $ln;
Branch: 1 branch
BranchTrueFalseTotal
my $subsection = $self->{"OPM_subsection"} or &error(&__x("subsubsection '{name}' outside section in {file} line {line}", "name", $line, "file", $fn, "line", $ln)) 0 0 0
387  
388 my $subsubsection = $self->{OPM_subsubsection} =
389 0 OODoc::Text::SubSubSection->new(name => $line, subsection => $subsection, linenr => $ln);
390  
391 0 $subsection->subsubsection($subsubsection);
392 0 $self->setBlock($subsubsection->openDescription);
393 0 $subsubsection;
394 }
395  
396 sub closeSubSubSection()
397 0 ▶{ my $self = shift;
Subroutine closeSubSubSection: not called CC=1 SCAR=6.9
Pod undocumented
398 0 delete $self->{OPM_subsubsection};
399 0 $self->closeSubroutine;
400 }
401  
402 # SUBROUTINES
403  
404  
405 sub docSubroutine($$$$)
406 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine docSubroutine: not called CC=8 SCAR=42.8
Pod undocumented
407  
408 0 chomp $line;
409 0 $line =~ s/^\=(\w+)\s+//;
410 0 my $type = $1;
411  
412 0 ▶ my ($name, $params)
Branch: 2 branches
BranchTrueFalseTotal
$type eq 'tie' ? : 0 0 0
$type eq 'overload' ? : 0 0 0
413 = $type eq 'tie' ? $line =~ m/^([\$\@\%\*]\w+)\,?\s*(.*?)\s*$/
414 : $type eq 'overload' ? $line =~ m/^(\S+)\s*(.*?)\s*$/
415 : $line =~ m/^(\w+)\s*(.*?)\s*$/;
416  
417 0 ▶ defined $name
Branch: 1 branch
BranchTrueFalseTotal
defined $name or &error(&__x("subroutine type '{type}' without name in {file} line {line}", "type", $type, "file", $fn, "line", $ln)) 0 0 0
418 or error __x"subroutine type '{type}' without name in {file} line {line}", type => $type, file => $fn, line => $ln;
419  
420 my $container = $self->{OPM_subsection} || $self->{OPM_section} || $self->{OPM_chapter}
421 0 ▶ or error __x"subroutine {name} outside chapter in {file} line {line}", name => $name, file => $fn, line => $ln;
Branch: 1 branch
BranchTrueFalseTotal
my $container = $self->{"OPM_subsection"} || $self->{"OPM_section"} || $self->{"OPM_chapter"} or &error(&__x("subroutine {name} outside chapter in {file} line {line}", "name", $name, "file", $fn, "line", $ln)) 0 0 0
Condition0%0/6
$self->{'OPM_subsection'} || $self->{'OPM_section'} || $self->{'OPM_chapter'}
l!l&&r!l&&!r
000
$self->{"OPM_subsection"} or $self->{"OPM_section"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$self->{'OPM_subsection'} || $self->{'OPM_section'} || $self->{'OPM_chapter'}
$self->{"OPM_subsection"} $self->{"OPM_section"} $self->{'OPM_chapter'}
Truth table0%0/4
A or B || C
A= $self->{"OPM_subsection"}B= $self->{"OPM_section"}C= $self->{'OPM_chapter'}
ABCresult
1XX1
01X1
0011
0000
422  
423 0 ▶ $type = 'i_method' if $type eq 'method';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "method" 0 0 0
424 0 my $sub = $self->{OPM_subroutine} = OODoc::Text::Subroutine->new(type => $type, name => $name,
425 parameters => $params, linenr => $ln, container => $container);
426  
427 0 $self->setBlock($sub->openDescription);
428 0 $container->addSubroutine($fn, $sub);
429 0 $sub;
430 }
431  
432 0 ▶sub activeSubroutine() { $_[0]->{OPM_subroutine} }
Subroutine activeSubroutine: not called CC=1 SCAR=6.9
Pod undocumented
433  
434 sub closeSubroutine()
435 0 ▶{ my $self = shift;
Subroutine closeSubroutine: not called CC=1 SCAR=6.9
Pod undocumented
436 0 delete $self->{OPM_subroutine};
437 0 $self;
438 }
439  
440 # SUBROUTINE ADDITIONALS
441  
442  
443 sub docOption($$$$)
444 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine docOption: not called CC=3 SCAR=24.8
Pod undocumented
445  
446 0 ▶ unless($line =~ m/^\=option\s+(\S+)\s+(.+?)\s*$/ )
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /^\=option\s+(\S+)\s+(.+?)\s*$/) 0 0 0
447 0 { warning __x"option line incorrect in {file} line {linenr}:\n {line}", file => $fn, linenr => $ln, line => $line;
448 0 return;
449 }
450 0 my ($name, $parameters) = ($1, $2);
451  
452 0 ▶ my $sub = $self->activeSubroutine
Branch: 1 branch
BranchTrueFalseTotal
my $sub = $self->activeSubroutine or &error(&__x("option {name} outside subroutine in {file} line {linenr}", "name", $name, "file", $fn, "linenr", $ln)) 0 0 0
453 or error __x"option {name} outside subroutine in {file} line {linenr}", name => $name, file => $fn, linenr => $ln;
454  
455 0 my $option = OODoc::Text::Option->new(
456 name => $name,
457 parameters => $parameters,
458 linenr => $ln,
459 subroutine => $sub
460 );
461  
462 0 $self->setBlock($option->openDescription);
463 0 $sub->option($option);
464 0 $sub;
465 }
466  
467 # DEFAULT
468  
469  
470 sub docDefault($$$$)
471 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine docDefault: not called CC=3 SCAR=24.8
Pod undocumented
472  
473 0 ▶ unless($line =~ m/^\=default\s+(\S+)\s+(.+?)\s*$/ )
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /^\=default\s+(\S+)\s+(.+?)\s*$/) 0 0 0
474 0 { warning __x"default line incorrect in {file} line {linenr}:\n {line}", file => $fn, linenr => $ln, line => $line;
475 0 return;
476 }
477  
478 0 my ($name, $value) = ($1, $2);
479  
480 0 ▶ my $sub = $self->activeSubroutine
Branch: 1 branch
BranchTrueFalseTotal
my $sub = $self->activeSubroutine or &error(&__x("default for option {name} outside subroutine in {file} line {linenr}", "name", $name, "file", $fn, "linenr", $ln)) 0 0 0
481 or error __x"default for option {name} outside subroutine in {file} line {linenr}", name => $name, file => $fn, linenr => $ln;
482  
483 0 my $default = OODoc::Text::Default->new(name => $name, value => $value, linenr => $ln, subroutine => $sub);
484  
485 0 $sub->default($default);
486 0 $sub;
487 }
488  
489 sub docRequires($$$$)
490 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine docRequires: not called CC=2 SCAR=17.9
Pod undocumented
491  
492 0 ▶ unless($line =~ m/^\=requires\s+(\w+)\s+(.+?)\s*$/ )
Branch: 1 branch
BranchTrueFalseTotal
unless ($line =~ /^\=requires\s+(\w+)\s+(.+?)\s*$/) 0 0 0
493 0 { warning __x"requires line incorrect in {file} line {linenr}:\n {line}", file => $fn, linenr => $ln, line => $line;
494 0 return;
495 }
496  
497 0 my ($name, $param) = ($1, $2);
498 0 $self->docOption ($match, "=option $name $param", $fn, $ln);
499 0 $self->docDefault($match, "=default $name <required>", $fn, $ln);
500 }
501  
502 # DIAGNOSTICS
503  
504  
505 sub docDiagnostic($$$$)
506 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine docDiagnostic: not called CC=3 SCAR=24.8
Pod undocumented
507  
508 0 $line =~ s/^\=(\w+)\s*//;
509 0 my $type = $1;
510  
511 0 $line =~ s/\s*$//;
512 0 ▶ unless(length $line)
Branch: 1 branch
BranchTrueFalseTotal
unless (length $line) 0 0 0
513 0 { warning __x"no diagnostic message supplied in {file} line {linenr}", file => $fn, linenr => $ln;
514 0 return;
515 }
516  
517 0 ▶ my $sub = $self->activeSubroutine
Branch: 1 branch
BranchTrueFalseTotal
my $sub = $self->activeSubroutine or &error(&__x("diagnostic {type} outside subroutine in {file} line {linenr}", "type", $type, "file", $fn, "linenr", $ln)) 0 0 0
518 or error __x"diagnostic {type} outside subroutine in {file} line {linenr}", type => $type, file => $fn, linenr => $ln;
519  
520 0 my $diag = OODoc::Text::Diagnostic->new(type => ucfirst($type), name => $line, linenr => $ln, subroutine => $sub);
521  
522 0 $self->setBlock($diag->openDescription);
523 0 $sub->diagnostic($diag);
524 0 $sub;
525 }
526  
527 # EXAMPLE
528  
529  
530 sub docExample($$$$)
531 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine docExample: not called CC=7 SCAR=40.3
Pod undocumented
532  
533 0 $line =~ s/^=examples?\s*//;
534 0 $line =~ s/^\#.*//;
535  
536 my $container = $self->activeSubroutine
537 || $self->{OPM_subsubsection}
538 || $self->{OPM_subsection}
539 || $self->{OPM_section}
540 0 ▶ || $self->{OPM_chapter};
Condition0%0/12
$self->activeSubroutine || $self->{'OPM_subsubsection'} || $self->{'OPM_subsection'} || $self->{'OPM_section'} || $self->{'OPM_chapter'}
l!l&&r!l&&!r
000
$self->activeSubroutine or $self->{"OPM_subsubsection"} or $self->{"OPM_subsection"} or $self->{"OPM_section"}
l!l&&r!l&&!r
000
$self->activeSubroutine or $self->{"OPM_subsubsection"} or $self->{"OPM_subsection"}
l!l&&r!l&&!r
000
$self->activeSubroutine or $self->{"OPM_subsubsection"}
l!l&&r!l&&!r
000
MC/DC0%0/5
$self->activeSubroutine || $self->{'OPM_subsubsection'} || $self->{'OPM_subsection'} || $self->{'OPM_section'} || $self->{'OPM_chapter'}
$self->activeSubroutine $self->{"OPM_subsubsection"} $self->{"OPM_subsection"} $self->{"OPM_section"} $self->{'OPM_chapter'}
Truth table0%0/6
A or B or C or D || E
A= $self->activeSubroutineB= $self->{"OPM_subsubsection"}C= $self->{"OPM_subsection"}D= $self->{"OPM_section"}E= $self->{'OPM_chapter'}
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
541  
542 0 ▶ defined $container
Branch: 1 branch
BranchTrueFalseTotal
defined $container or &error(&__x("example outside chapter in {file} line {linenr}", "file", $fn, "linenr", $ln)) 0 0 0
543 or error __x"example outside chapter in {file} line {linenr}", file => $fn, linenr => $ln;
544  
545 0 ▶ my $example = OODoc::Text::Example->new(name => ($line || ''), linenr => $ln, container => $container);
Condition0%0/2
$line || ''
l!l
00
MC/DC0%0/1
$line || ''
$line
Truth table0%0/2
A
A= $line
Aresult
11
00
546  
547 0 $self->setBlock($example->openDescription);
548 0 $container->addExample($example);
549 0 $example;
550 }
551  
552  
553 sub debugRemains($$$$)
554 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine debugRemains: not called CC=3 SCAR=24.8
Pod undocumented
555  
556 0 ▶ $self->inDoc || $self->currentManual->isPurePod
Branch: 1 branch
BranchTrueFalseTotal
$self->inDoc or $self->currentManual->isPurePod or &warning(&__x("debugging remains in {file} line {linenr}", "file", $fn, "linenr", $ln)) 0 0 0
Condition0%0/3
$self->inDoc or $self->currentManual->isPurePod
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->inDoc or $self->currentManual->isPurePod
$self->inDoc $self->currentManual->isPurePod
Truth table0%0/3
A or B
A= $self->inDocB= $self->currentManual->isPurePod
ABresult
1X1
011
000
557 or warning __x"debugging remains in {file} line {linenr}", file => $fn, linenr => $ln;
558  
559 0 undef;
560 }
561  
562  
563 sub forgotCut($$$$)
564 0 ▶{ my ($self, $match, $line, $fn, $ln) = @_;
Subroutine forgotCut: not called CC=3 SCAR=24.8
Pod undocumented
565  
566 0 ▶ $self->inDoc && ! $self->currentManual->isPurePod
Branch: 1 branch
BranchTrueFalseTotal
$self->inDoc and not $self->currentManual->isPurePod and &warning(&__x("You may have accidentally captured code in doc {file} line {linenr}", "file", $fn, "linenr", $ln)) 0 0 0
Condition0%0/3
$self->inDoc and not $self->currentManual->isPurePod
!ll&&!rl&&r
000
MC/DC0%0/2
$self->inDoc and not $self->currentManual->isPurePod
$self->inDoc not $self->currentManual->isPurePod
Truth table0%0/3
A and not(B)
A= $self->inDocB= not $self->currentManual->isPurePod
ABresult
0X0
100
111
567 and warning __x"You may have accidentally captured code in doc {file} line {linenr}", file => $fn, linenr => $ln;
568  
569 0 undef;
570 }
571  
572 #--------------------
573  
574 sub decomposeM($$)
575 0 ▶{ my ($self, $manual, $link) = @_;
Subroutine decomposeM: not called CC=18 SCAR=58.3
Pod documented
576  
577 0 ▶ my ($subroutine, $option) = $link =~ s/
Branch: 1 branch
BranchTrueFalseTotal
$link =~ s/ (?:^|\:\:) # skip till last :: (\w+ | '[^']+') # sub or overload between quotes \( (.*?) \) # parameters $//x ? : 0 0 0
578 (?:^|\:\:) # skip till last ::
579 (\w+ | '[^']+') # sub or overload between quotes
580 \( (.*?) \) # parameters
581 $//x ? ($1, $2) : ('', '');
582  
583 0 my $man;
584 0 ▶ if(not length($link)) { $man = $manual }
Branch: 2 branches
BranchTrueFalseTotal
if (not length $link) { } 0 0 0
elsif (defined($man = $self->index->findManual($link))) { } 0 0 0
585 elsif(defined($man = $self->index->findManual($link))) { ; }
586 else
587 0 { eval "no warnings; require $link";
588 0 ▶ if( ! $@
Branch: 2 branches
BranchTrueFalseTotal
if (not $@ or $@ =~ /attempt to reload/i or $self->skipManualLink($link)) { } 0 0 0
elsif ($@ =~ /Can't locate/) { } 0 0 0
Condition0%0/6
not $@ or $@ =~ /attempt to reload/i or $self->skipManualLink($link)
l!l&&r!l&&!r
000
not $@ or $@ =~ /attempt to reload/i
l!l&&r!l&&!r
000
MC/DC0%0/3
not $@ or $@ =~ /attempt to reload/i or $self->skipManualLink($link)
not $@ $@ =~ /attempt to reload/i $self->skipManualLink($link)
Truth table0%0/4
not(A) or B or C
A= not $@B= $@ =~ /attempt to reload/iC= $self->skipManualLink($link)
ABCresult
1XX1
01X1
0011
0000
589 || $@ =~ m/attempt to reload/i
590 || $self->skipManualLink($link)
591 ) { ; }
592 elsif($@ =~ m/Can't locate/ )
593 0 { warning __x"module {name} is not on your system, found in {manual}", name => $link, manual => $manual;
594 }
595 else
596 0 { $@ =~ s/ at \(eval.*//;
597 0 warning __x"use problem for module {name} in {manual};\n{err}", name => $link, manual => $manual, err => $@;
598 }
599 0 $man = $link;
600 }
601  
602 0 ▶ blessed $man or return ($manual, $man
Branch: 3 branches
BranchTrueFalseTotal
builtin::blessed($man) or return $manual, $man . (length $subroutine ? " subroutine $subroutine" : "") . (length $option ? " option $option" : "") 0 0 0
length $subroutine ? : 0 0 0
length $option ? : 0 0 0
603 . (length $subroutine ? " subroutine $subroutine" : '')
604 . (length $option ? " option $option" : ''),
605 );
606  
607 0 ▶ defined $subroutine && length $subroutine
Branch: 1 branch
BranchTrueFalseTotal
defined $subroutine and length $subroutine or return undef, $man 0 0 0
Condition0%0/3
defined $subroutine and length $subroutine
!ll&&!rl&&r
000
MC/DC0%0/2
defined $subroutine and length $subroutine
defined $subroutine length $subroutine
Truth table0%0/3
A and B
A= defined $subroutineB= length $subroutine
ABresult
0X0
100
111
608 or return (undef, $man);
609  
610 0 my $package = $self->index->findManual($man->package);
611 0 ▶ unless(defined $package)
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $package) 0 0 0
612 0 { my $want = $man->package;
613 0 warning __x"no manual for {package} (correct casing?)", package => $want;
614 0 return (undef, "$want subroutine $subroutine");
615 }
616  
617 0 my $sub = $package->subroutine($subroutine);
618 0 ▶ unless(defined $sub)
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $sub) 0 0 0
619 0 { warning __x"subroutine {call}() is not defined by {pkg}, but linked to in {manual}",
620 call => $subroutine, pkg => $package, manual => $manual;
621 0 return ($package, "$package subroutine $subroutine");
622 }
623  
624 0 my $location = $sub->manual;
625 0 ▶ defined $option && length $option
Branch: 1 branch
BranchTrueFalseTotal
defined $option and length $option or return $location, $sub 0 0 0
Condition0%0/3
defined $option and length $option
!ll&&!rl&&r
000
MC/DC0%0/2
defined $option and length $option
defined $option length $option
Truth table0%0/3
A and B
A= defined $optionB= length $option
ABresult
0X0
100
111
626 or return ($location, $sub);
627  
628 0 my $opt = $sub->findOption($option);
629 0 ▶ unless(defined $opt)
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $opt) 0 0 0
630 0 { warning __x"option '{name}' unknown for {call}() in {where}, found in {manual}",
631 name => $option, call => $subroutine, where => $location, manual => $manual;
632 0 return ($location, "$package subroutine $subroutine option $option");
633 }
634  
635 0 ($location, $opt);
636 }
637  
638  
639 sub decomposeL($$)
640 0 ▶{ my ($self, $manual, $link) = @_;
Subroutine decomposeL: not called CC=20 SCAR=60.4
Pod documented
641 0 ▶ my $text = $link =~ s/^([^|]*)\|// ? $1 : undef;
Branch: 1 branch
BranchTrueFalseTotal
$link =~ s/^([^|]*)\|// ? : 0 0 0
642  
643 0 ▶ length $link
Branch: 1 branch
BranchTrueFalseTotal
length $link or &warning(&__x("empty L link in {manual}", "manual", $manual)), (return ()) 0 0 0
644 or (warning __x"empty L link in {manual}", manual => $manual), return ();
645  
646 0 ▶ return (undef, undef, $link, $text // $link)
Branch: 1 branch
BranchTrueFalseTotal
if $link =~ /^[a-z]+\:[^:]/ 0 0 0
Condition0%0/3
$text // $link
l!l&&r!l&&!r
000
MC/DC0%0/2
$text // $link
$text $link
Truth table0%0/3
A // B
A= $textB= $link
ABresult
1X1
011
000
647 if $link =~ m/^[a-z]+\:[^:]/;
648  
649 0 my ($name, $item) = $link =~ m[(.*?)(?:/(.*))?$];
650  
651 0 ▶ ($name, $item) = (undef, $name) if $name =~ m/^".*"$/;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /^".*"$/ 0 0 0
652 0 ▶ $item =~ s/^"(.*)"$/$1/ if defined $item;
Branch: 1 branch
BranchTrueFalseTotal
if defined $item 0 0 0
653  
654 0 ▶ my $man = length $name ? ($self->index->findManual($name) || $name) : $manual;
Branch: 1 branch
BranchTrueFalseTotal
length $name ? : 0 0 0
Condition0%0/3
$self->index->findManual($name) or $name
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->index->findManual($name) or $name
$self->index->findManual($name) $name
Truth table0%0/3
A or B
A= $self->index->findManual($name)B= $name
ABresult
1X1
011
000
655  
656 0 my $dest;
657 0 ▶ if(!ref $man)
Branch: 3 branches
BranchTrueFalseTotal
if (not ref $man) { } 0 0 0
elsif (not defined $item) { } 0 0 0
elsif (my(@obj) = $man->all('findEntry', $item)) { } 0 0 0
658 0 ▶ { unless(defined $text && length $text)
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $text and length $text) 0 0 0
Condition0%0/3
defined $text and length $text
!ll&&!rl&&r
000
MC/DC0%0/2
defined $text and length $text
defined $text length $text
Truth table0%0/3
A and B
A= defined $textB= length $text
ABresult
0X0
100
111
659 0 { $text = "manual $man";
660 0 ▶ $text .= " entry $item" if defined $item && length $item;
Branch: 1 branch
BranchTrueFalseTotal
if defined $item and length $item 0 0 0
Condition0%0/3
defined $item and length $item
!ll&&!rl&&r
000
MC/DC0%0/2
defined $item and length $item
defined $item length $item
Truth table0%0/3
A and B
A= defined $itemB= length $item
ABresult
0X0
100
111
661 }
662  
663 0 ▶ if($man !~ m/\(\d.*\)\s*$/)
Branch: 1 branch
BranchTrueFalseTotal
unless ($man =~ /\(\d.*\)\s*$/) 0 0 0
664 0 { my $escaped = $man =~ s/\W+/_/gr;
665 0 $dest = "$url_modsearch$escaped";
666 }
667 }
668 elsif(!defined $item)
669 0 { $dest = $man;
670 0 ▶ $text //= $man->name;
Condition0%0/3
$text //= $man->name
l!l&&r!l&&!r
000
MC/DC0%0/2
$text //= $man->name
$text $man->name
Truth table0%0/3
A //= B
A= $textB= $man->name
ABresult
1X1
011
000
671 }
672 elsif(my @obj = $man->all(findEntry => $item))
673 0 { $dest = shift @obj;
674 0 ▶ $text //= $item;
Condition0%0/3
$text //= $item
l!l&&r!l&&!r
000
MC/DC0%0/2
$text //= $item
$text $item
Truth table0%0/3
A //= B
A= $textB= $item
ABresult
1X1
011
000
675 }
676 else
677 0 { warning __x"manual {manual} links to unknown entry '{item}' in {other_manual}", manual => $manual, item => $item, other_manual => $man;
678 0 $dest = $man;
679 0 ▶ $text //= "$man";
Condition0%0/2
$text //= "$man"
l!l
00
MC/DC0%0/1
$text //= "$man"
$text
Truth table0%0/2
A
A= $text
Aresult
11
00
680 }
681  
682 0 ($man, $dest, undef, $text);
683 }
684  
685 sub cleanupPod($$$)
686 0 ▶{ my ($self, $manual, $string, %args) = @_;
Subroutine cleanupPod: not called CC=25 SCAR=64.8
Pod documented
687 0 ▶ defined $string && length $string or return '';
Branch: 1 branch
BranchTrueFalseTotal
defined $string and length $string or return "" 0 0 0
Condition0%0/3
defined $string and length $string
!ll&&!rl&&r
000
MC/DC0%0/2
defined $string and length $string
defined $string length $string
Truth table0%0/3
A and B
A= defined $stringB= length $string
ABresult
0X0
100
111
688  
689 0 my @lines = split /^/, $string;
690 0 my $protect;
691  
692 0 ▶ for(my $i=0; $i < @lines; $i++)
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @lines) 0 0 0
693 0 ▶ { $protect = $1 if $lines[$i] =~ m/^=(for|begin)\s+\w/;
Branch: 1 branch
BranchTrueFalseTotal
if $lines[$i] =~ /^=(for|begin)\s+\w/ 0 0 0
694  
695 0 ▶ undef $protect if $lines[$i] =~ m/^=end/;
Branch: 1 branch
BranchTrueFalseTotal
if $lines[$i] =~ /^=end/ 0 0 0
696 0 ▶ undef $protect if $lines[$i] =~ m/^\s*$/ && $protect && $protect eq 'for';
Branch: 1 branch
BranchTrueFalseTotal
if $lines[$i] =~ /^\s*$/ and $protect and $protect eq "for" 0 0 0
Condition0%0/6
$lines[$i] =~ /^\s*$/ and $protect and $protect eq "for"
!ll&&!rl&&r
000
$lines[$i] =~ /^\s*$/ and $protect
!ll&&!rl&&r
000
MC/DC0%0/3
$lines[$i] =~ /^\s*$/ and $protect and $protect eq "for"
$lines[$i] =~ /^\s*$/ $protect $protect eq "for"
Truth table0%0/4
A and B and C
A= $lines[$i] =~ /^\s*$/B= $protectC= $protect eq "for"
ABCresult
0XX0
10X0
1100
1111
697 0 ▶ next if $protect;
Branch: 1 branch
BranchTrueFalseTotal
if $protect 0 0 0
698  
699 0 $lines[$i] =~ s/\bP\<([^>]*)\>/C<$1>/g;
700 0 $lines[$i] =~ s/\bM\<([^>]*)\>/$self->cleanupPodM($manual, $1, \%args)/ge;
701  
702 0 ▶ $lines[$i] =~ s/\bL\<([^>]*)\>/$self->cleanupPodL($manual, $1, \%args)/ge
Branch: 1 branch
BranchTrueFalseTotal
if substr($lines[$i], 0, 1) eq " " 0 0 0
703 if substr($lines[$i], 0, 1) eq ' ';
704  
705 # permit losing blank lines around pod statements.
706 0 ▶ if(substr($lines[$i], 0, 1) eq '=')
Branch: 1 branch
BranchTrueFalseTotal
if (substr($lines[$i], 0, 1) eq '=') { } 0 0 0
707 0 ▶ { if($i > 0 && $lines[$i-1] ne "\n")
Branch: 2 branches
BranchTrueFalseTotal
if ($i > 0 and $lines[$i - 1] ne "\n") { } 0 0 0
elsif ($i < $#lines and $lines[$i + 1] ne "\n" and substr($lines[$i], 0, 5) ne '=for ') { } 0 0 0
Condition0%0/3
$i > 0 and $lines[$i - 1] ne "\n"
!ll&&!rl&&r
000
MC/DC0%0/2
$i > 0 and $lines[$i - 1] ne "\n"
$i > 0 $lines[$i - 1] ne "\n"
Truth table0%0/3
A and B
A= $i > 0B= $lines[$i - 1] ne "\n"
ABresult
0X0
100
111
708 0 { splice @lines, $i-1, 0, "\n";
709 0 $i++;
710 }
711 ▶ elsif($i < $#lines && $lines[$i+1] ne "\n" && substr($lines[$i], 0, 5) ne "=for ")
Condition0%0/6
$i < $#lines and $lines[$i + 1] ne "\n" and substr($lines[$i], 0, 5) ne "=for "
!ll&&!rl&&r
000
$i < $#lines and $lines[$i + 1] ne "\n"
!ll&&!rl&&r
000
MC/DC0%0/3
$i < $#lines and $lines[$i + 1] ne "\n" and substr($lines[$i], 0, 5) ne "=for "
$i < $#lines $lines[$i + 1] ne "\n" substr($lines[$i], 0, 5) ne "=for "
Truth table0%0/4
A and B and C
A= $i < $#linesB= $lines[$i + 1] ne "\n"C= substr($lines[$i], 0, 5) ne "=for "
ABCresult
0XX0
10X0
1100
1111
712 0 { splice @lines, $i+1, 0, "\n";
713 }
714 }
715 else
716 0 { $lines[$i] =~ s/^\\\=/=/;
717 }
718  
719 # Remove superfluous blanks
720 0 ▶ if($i < $#lines && $lines[$i] eq "\n" && $lines[$i+1] eq "\n")
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $#lines and $lines[$i] eq "\n" and $lines[$i + 1] eq "\n") 0 0 0
Condition0%0/6
$i < $#lines and $lines[$i] eq "\n" and $lines[$i + 1] eq "\n"
!ll&&!rl&&r
000
$i < $#lines and $lines[$i] eq "\n"
!ll&&!rl&&r
000
MC/DC0%0/3
$i < $#lines and $lines[$i] eq "\n" and $lines[$i + 1] eq "\n"
$i < $#lines $lines[$i] eq "\n" $lines[$i + 1] eq "\n"
Truth table0%0/4
A and B and C
A= $i < $#linesB= $lines[$i] eq "\n"C= $lines[$i + 1] eq "\n"
ABCresult
0XX0
10X0
1100
1111
721 0 { splice @lines, $i+1, 1;
722 }
723 }
724  
725 # remove leading and trailing blank lines
726 0 ▶ shift @lines while @lines && $lines[0] eq "\n";
Branch: 1 branch
BranchTrueFalseTotal
@lines and $lines[0] eq "\n" and do { shift @lines } 0 0 0
Condition0%0/3
@lines and $lines[0] eq "\n"
!ll&&!rl&&r
000
MC/DC0%0/2
@lines and $lines[0] eq "\n"
@lines $lines[0] eq "\n"
Truth table0%0/3
A and B
A= @linesB= $lines[0] eq "\n"
ABresult
0X0
100
111
727 0 ▶ pop @lines while @lines && $lines[-1] eq "\n";
Branch: 1 branch
BranchTrueFalseTotal
@lines and $lines[-1] eq "\n" and do { pop @lines } 0 0 0
Condition0%0/3
@lines and $lines[-1] eq "\n"
!ll&&!rl&&r
000
MC/DC0%0/2
@lines and $lines[-1] eq "\n"
@lines $lines[-1] eq "\n"
Truth table0%0/3
A and B
A= @linesB= $lines[-1] eq "\n"
ABresult
0X0
100
111
728  
729 0 ▶ @lines ? join('', @lines) : '';
Branch: 1 branch
BranchTrueFalseTotal
@lines ? : 0 0 0
730 }
731  
732  
733 sub cleanupPodM($$$)
734 0 ▶{ my ($self, $manual, $link, $args) = @_;
Subroutine cleanupPodM: not called CC=2 SCAR=17.9
Pod documented
735 0 my ($toman, $to) = $self->decomposeM($manual, $link);
736 0 ▶ blessed $to ? $args->{create_link}->($toman, $to, $link, $args) : $to;
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($to) ? : 0 0 0
737 }
738  
739  
740 sub cleanupPodL($$$)
741 0 ▶{ my ($self, $manual, $link, $args) = @_;
Subroutine cleanupPodL: not called CC=1 SCAR=6.9
Pod documented
742 0 my ($toman, $to, $href, $text) = $self->decomposeL($manual, $link);
743 0 $text;
744 }
745  
746 sub _htmlReformat($$$$)
747 0 ▶{ my ($self, $manual, $key, $body, $args) = @_;
Subroutine _htmlReformat: not called CC=12 SCAR=50.5
748 0 ▶ $key eq 'B' ? "<b>$body</b>"
Branch: 11 branches
BranchTrueFalseTotal
$key eq 'B' ? : 0 0 0
$key eq 'C' ? : 0 0 0
$key eq 'E' ? : 0 0 0
$key eq 'F' ? : 0 0 0
$key eq 'I' ? : 0 0 0
$key eq 'L' ? : 0 0 0
$key eq 'M' ? : 0 0 0
$key eq 'P' ? : 0 0 0
$key eq 'S' ? : 0 0 0
$key eq 'X' ? : 0 0 0
$key eq 'Z' ? : 0 0 0
749 : $key eq 'C' ? "<code>$body</code>"
750 : $key eq 'E' ? "&$body;"
751 : $key eq 'F' ? qq{<i class="filename">$body</i>}
752 : $key eq 'I' ? "<i>$body</i>"
753 : $key eq 'L' ? $self->cleanupHtmlL($manual, $body, $args)
754 : $key eq 'M' ? $self->cleanupHtmlM($manual, $body, $args)
755 : $key eq 'P' ? qq{<tt class="parameter">$body</tt>}
756 : $key eq 'S' ? $body =~ s/[ ]/&nbsp;/gr
757 : $key eq 'X' ? ''
758 : $key eq 'Z' ? '&ZeroWidthSpace;'
759 : error __x"Unknown format key '{key}' in manual {manual}", key => $key, manual => $manual->name;
760 }
761  
762 sub _htmlItems($)
763 0 ▶{ my ($self, $manual, $block) = @_;
Subroutine _htmlItems: not called CC=2 SCAR=17.9
764 0 ▶ my $type = $block =~ m!^=item\s+\d+\.!m ? 'ol' : 'ul';
Branch: 1 branch
BranchTrueFalseTotal
$block =~ /^=item\s+\d+\./m ? : 0 0 0
765 0 $block =~ s#^\=item\s*(?:\*\s*|\d+\.\s*)?([^\n]*)#\n<li>$1<br />#gms;
766 0 "<$type>$block</$type>";
767 }
768  
769 sub cleanupHtml($$$)
770 0 ▶{ my ($self, $manual, $string, %args) = @_;
Subroutine cleanupHtml: not called CC=9 SCAR=45.0
Pod documented
771 0 ▶ defined $string && length $string or return '';
Branch: 1 branch
BranchTrueFalseTotal
defined $string and length $string or return "" 0 0 0
Condition0%0/3
defined $string and length $string
!ll&&!rl&&r
000
MC/DC0%0/2
defined $string and length $string
defined $string length $string
Truth table0%0/3
A and B
A= defined $stringB= length $string
ABresult
0X0
100
111
772  
773 0 my $is_html = $args{is_html};
774  
775 0 ▶ if($string =~ m/(?:\A|\n) # start of line
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /(?:\A|\n) # start of line \=begin\s+(:?\w+)\s* # begin statement (.*?) # encapsulated \n\=end\s+\1\s* # related end statement /sx or $string =~ /(?:\A|\n) # start of line \=for\s+(:?\w+)\b # for statement (.*?)\n # encapsulated (\n|\Z) # end of paragraph /sx) 0 0 0
Condition0%0/3
$string =~ /(?:\A|\n) # start of line \=begin\s+(:?\w+)\s* # begin statement (.*?) # encapsulated \n\=end\s+\1\s* # related end statement /sx or $string =~ /(?:\A|\n) # start of line \=for\s+(:?\w+)\b # for statement (.*?)\n # encapsulated (\n|\Z) # end of paragraph /sx
l!l&&r!l&&!r
000
MC/DC0%0/2
$string =~ /(?:\A|\n) # start of line \=begin\s+(:?\w+)\s* # begin statement (.*?) # encapsulated \n\=end\s+\1\s* # related end statement /sx or $string =~ /(?:\A|\n) # start of line \=for\s+(:?\w+)\b # for statement (.*?)\n # encapsulated (\n|\Z) # end of paragraph /sx
$string =~ /(?:\A|\n) # start of line \=begin\s+(:?\w+)\s* # begin statement (.*?) # encapsulated \n\=end\s+\1\s* # related end statement /sx $string =~ /(?:\A|\n) # start of line \=for\s+(:?\w+)\b # for statement (.*?)\n # encapsulated (\n|\Z) # end of paragraph /sx
Truth table0%0/3
A or B
A= $string =~ /(?:\A|\n) # start of line \=begin\s+(:?\w+)\s* # begin statement (.*?) # encapsulated \n\=end\s+\1\s* # related end statement /sxB= $string =~ /(?:\A|\n) # start of line \=for\s+(:?\w+)\b # for statement (.*?)\n # encapsulated (\n|\Z) # end of paragraph /sx
ABresult
1X1
011
000
776 \=begin\s+(:?\w+)\s* # begin statement
777 (.*?) # encapsulated
778 \n\=end\s+\1\s* # related end statement
779 /xs
780 || $string =~ m/(?:\A|\n) # start of line
781 \=for\s+(:?\w+)\b # for statement
782 (.*?)\n # encapsulated
783 (\n|\Z) # end of paragraph
784 /xs
785 )
786 0 { my ($before, $type, $capture, $after) = ($`, lc($1), $2, $');
787  
788 0 ▶ if($type =~ m/^\:?html\b/ )
Branch: 1 branch
BranchTrueFalseTotal
if ($type =~ /^\:?html\b/) 0 0 0
789 0 { $type = 'html';
790 0 $capture = $self->cleanupHtml($manual, $capture, %args, is_html => 1);
791 }
792  
793 0 return $self->cleanupHtml($manual, $before, %args)
794 . $capture
795 . $self->cleanupHtml($manual, $after, %args);
796 }
797  
798 0 for($string)
799 0 ▶ { unless($is_html)
Branch: 1 branch
BranchTrueFalseTotal
unless ($is_html) 0 0 0
800 0 { s#\&#\&amp;#g;
801 0 s#(\s|^) \< ([^<>]+) \> #$1&lt;$2&gt;#gx;
802 # s#(?<!\b[BCEFILSXMP<])\<#&lt;#g;
803 0 s#([=-])\>#$1\&gt;#g;
804 }
805 0 s# ([A-Z]) (?: \<\<\s*(.*?)\s*\>\> | \<(.*?)\> ) # $self->_htmlReformat($manual, $1, $+, \%args) #gxe;
806 0 s#^\=over(?:\s+\d+)?(.*?)=back#$self->_htmlItems($manual, $1)#gmes;
807 0 s#^\=pod\b##gm;
808  
809 0 my ($label, $level, $title);
810 0 s#^\=head([1-6])\s*([^\n]*)#
811 0 ($title, $level) = ($1, $2);
812 0 $label = $title =~ s/\W+/_/gr;
813 0 qq[<h$level class="$title"><a name="$label">$title</a></h$level>];
814 #ge;
815  
816 0 ▶ next if $is_html;
Branch: 1 branch
BranchTrueFalseTotal
if $is_html 0 0 0
817  
818 # Paragraphs are hard to detect. It is where POD and HTML have
819 # other ideas. Very tricky :-(
820  
821 0 s!((?:(?:^|\n)
822 [^\ \t\n]+[^\n]* # line starting with blank: para
823 )+)
824 !<p>$1</p>!gsx;
825  
826 0 s!\<p\>\n\<(/?ol|/?ul)\>\</p\>!<$1>!g; # overeager
827 0 s!\n*\<p\>\n\<(li)\>(.*?)\</p\>!\n<$1>$2!g;
828  
829 # fixed code blocks
830  
831 0 s!((?:(?:^|\n) # start of line
832 [\ \t]+[^\n]+ # line starting with blank: pre
833 )+)
834 !<pre>$1\n</pre>!gsx;
835  
836 0 s#</pre>\n<pre>##gs;
837 0 s#<p>\n#\n<p>#gs;
838 }
839  
840 0 $string;
841 }
842  
843  
844 sub cleanupHtmlM($$$)
845 0 ▶{ my ($self, $manual, $link, $args) = @_;
Subroutine cleanupHtmlM: not called CC=2 SCAR=17.9
Pod documented
846 0 my ($toman, $to) = $self->decomposeM($manual, $link);
847 0 ▶ ref $to ? $args->{create_link}->($toman, $to, $link, $args) : $to;
Branch: 1 branch
BranchTrueFalseTotal
ref $to ? : 0 0 0
848 }
849  
850  
851 sub cleanupHtmlL($$$)
852 0 ▶{ my ($self, $manual, $link, $args) = @_;
Subroutine cleanupHtmlL: not called CC=4 SCAR=30.0
Pod documented
853 0 my ($toman, $to, $href, $text) = $self->decomposeL($manual, $link);
854  
855 defined $href ? qq[<a href="$href" target="_blank">$text</a>]
856 : !defined $to ? $text
857 0 ▶ : blessed $to ? $args->{create_link}->($toman, $to, $text, $args)
Branch: 3 branches
BranchTrueFalseTotal
defined $href ? : 0 0 0
!defined($to) ? : 0 0 0
builtin::blessed($to) ? : 0 0 0
858 : qq[<a href="$to">$text</a>]
859 }
860  
861  
862 sub _collectParamsAllCaps($$$)
863 0 ▶{ my ($self, $params, $group, $string) = @_;
Subroutine _collectParamsAllCaps: not called CC=1 SCAR=6.9
864 0 $string =~ s/\b[A-Z](?:\<\<.*?\>\>|\<.*?\>)/ /g;
865 0 my @found = map +( $_ => $group ), $string =~ m! \b ([A-Z][A-Z\d]*) \b !gx;
866 0 +{ %$params, @found };
867 }
868  
869 sub _collectParams($$$)
870 0 ▶{ my ($self, $params, $group, $string) = @_;
Subroutine _collectParams: not called CC=1 SCAR=6.9
871 0 $string =~ s/\b[A-Z](?:\<\<.*?\>\>|\<.*?\>)/ /g;
872 0 my @found = map +( $_ => $group ), $string =~ m!( [\$\@\%]\w+ )!gx;
873 0 +{ %$params, @found };
874 }
875  
876 sub _markupSplit($)
877 0 ▶{ my ($self, $text) = @_;
Subroutine _markupSplit: not called CC=1 SCAR=6.9
878  
879 0 split /
880 ( \b[A-Z]\<\< .*? \>\> # double angled markup
881 | \b[A-Z]\< .*? \> # single angled markup
882 | ^ [ \t] [^\n]+ # document code blocks
883 )
884 /xms, $text;
885 }
886  
887 sub _markupText($$%)
888 0 ▶{ my ($self, $text, $where, %args) = @_;
Subroutine _markupText: not called CC=10 SCAR=47.0
889  
890 0 my @frags = $self->_markupSplit($text);
891 0 my @rewritten;
892  
893 0 ▶ while(@frags)
Branch: 1 branch
BranchTrueFalseTotal
if (@frags) 0 0 0
894 0 { my ($text, $markup) = (shift @frags, shift @frags);
895  
896 0 ▶ if($args{make_m})
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"make_m"}) 0 0 0
897 0 { $text =~ s/ \b ( [A-Z]\w+ (?: \:\: [A-Z]\w+ )+ ) \b /M<$1>/gx;
898 }
899  
900 0 ▶ if(my $c = $args{make_c})
Branch: 1 branch
BranchTrueFalseTotal
if (my $c = $args{"make_c"}) 0 0 0
901 0 { foreach my $w (@$c)
902 0 { $text =~ s/ \b (\Q$w\E) \b /C<$1>/gx;
903 }
904 }
905  
906 0 ▶ if($args{make_p})
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"make_p"}) 0 0 0
907 0 ▶ { my $params = $args{params} || {};
Condition0%0/2
$args{'params'} || {}
l!l
00
MC/DC0%0/1
$args{'params'} || {}
$args{'params'}
Truth table0%0/2
A
A= $args{'params'}
Aresult
11
00
908  
909 # auto-P variable
910 0 $text =~ s! ( [\$\@\%]\w+ ) !
911 0 my $p = $1;
912 0 ▶ $params->{$p}
Branch: 1 branch
BranchTrueFalseTotal
$params->{$p} ? : 0 0 0
913 ? "P<$p>"
914 : ((warning __x"in {where}, text uses unknown '{label}'", label => $p, where => $where), $p);
915 !gxe;
916  
917 # auto-P capitals, like HASH
918  
919 0 $text =~ s! ( \b[A-Z][A-Z\d]*\b ) !
920 0 my $p = $1;
921 0 ▶ $params->{$p} ? "P<$p>" : $p;
Branch: 1 branch
BranchTrueFalseTotal
$params->{$p} ? : 0 0 0
922 !gxe;
923 }
924  
925 0 push @rewritten, $text;
926 0 ▶ push @rewritten, $markup if defined $markup;
Branch: 1 branch
BranchTrueFalseTotal
if defined $markup 0 0 0
927 }
928  
929 0 join '', @rewritten;
930 }
931  
932 sub autoMarkup($$%)
933 0 ▶{ my ($self, $manual, $struct, %args) = @_;
Subroutine autoMarkup: not called CC=18 SCAR=58.3
Pod documented
934 0 ▶ return if $manual->inherited($struct);
Branch: 1 branch
BranchTrueFalseTotal
if $manual->inherited($struct) 0 0 0
935  
936 0 my $where = $manual->name . '/' . $struct->name;
937  
938 0 my $text = $struct->openDescription;
939 $$text = $self->_markupText($$text, $where, %args,
940 0 ▶ make_m => $args{make_m} && ! ( $struct->type eq 'Chapter' && $struct->name eq 'NAME' ),
Condition0%0/6
$args{'make_m'} && !($struct->type eq 'Chapter' && $struct->name eq 'NAME')
!ll&&!rl&&r
000
$struct->type eq 'Chapter' && $struct->name eq 'NAME'
!ll&&!rl&&r
000
MC/DC0%0/3
$args{'make_m'} && !($struct->type eq 'Chapter' && $struct->name eq 'NAME')
$args{'make_m'} $struct->type eq 'Chapter' $struct->name eq 'NAME'
Truth table0%0/4
A && not(B && C)
A= $args{'make_m'}B= $struct->type eq 'Chapter'C= $struct->name eq 'NAME'
ABCresult
0XX0
1110
10X1
1101
941 );
942  
943 0 foreach my $example ($struct->examples)
944 0 { my $ex = $example->openDescription;
945 0 $$ex = $self->_markupText($$ex, "an example in $where", %args);
946 }
947  
948 0 foreach my $sub ($struct->subroutines)
949 0 ▶ { next if $manual->inherited($sub);
Branch: 1 branch
BranchTrueFalseTotal
if $manual->inherited($sub) 0 0 0
950 0 my $w = $manual->name . '::' . $sub->name;
951  
952 0 my $params = +{};
953 0 ▶ if($sub->type =~ m!(_method$|^function$)!)
Branch: 1 branch
BranchTrueFalseTotal
if ($sub->type =~ /(_method$|^function$)/) 0 0 0
954 0 { $params = $self->_collectParams($params, call => $sub->parameters);
955 0 $params = $self->_collectParamsAllCaps($params, call => $sub->parameters);
956 }
957  
958 0 my @options = $sub->options;
959 0 ▶ !@options || $params->{'%options'}
Branch: 1 branch
BranchTrueFalseTotal
not @options or $params->{"%options"} or &warning(&__x("in {where}, options but no call parameter %options", "where", "$w()")) 0 0 0
Condition0%0/3
not @options or $params->{"%options"}
l!l&&r!l&&!r
000
MC/DC0%0/2
not @options or $params->{"%options"}
not @options $params->{"%options"}
Truth table0%0/3
not(A) or B
A= not @optionsB= $params->{"%options"}
ABresult
1X1
011
000
960 or warning __x"in {where}, options but no call parameter %options", where => "$w()";
961  
962 # Specifying possible %options without defining one is not a
963 # problem: maybe the extension uses them.
964 0 $params->{$_->name} = 'option' for @options;
965  
966 0 my $st = $sub->openDescription;
967 0 $$st = $self->_markupText($$st, "$w()", %args, params => $params);
968  
969 OPTION:
970 0 foreach my $option (@options)
971 0 ▶ { next if $manual->inherited($option);
Branch: 1 branch
BranchTrueFalseTotal
if $manual->inherited($option) 0 0 0
972 0 my $p = $self->_collectParams($params, option => $option->parameters);
973  
974 0 my $name = $option->name;
975 0 my $default = $sub->default($name);
976 0 ▶ unless($default)
Branch: 1 branch
BranchTrueFalseTotal
unless ($default) 0 0 0
977 0 { warning __x"option {where} has no default", where => "$w($name)";
978 0 next OPTION;
979 }
980  
981 0 my $v = $default->value;
982 0 my $q = $self->_collectParams($p, default => $v);
983  
984 # modify the default value
985 0 my $dv = $self->_markupText($v, "$w(D=$name)", %args, params => $q);
986 0 $default->_setValue($dv);
987  
988 # modify the option text
989 0 my $opt = $option->openDescription;
990 0 $$opt = $self->_markupText($$opt, "$w($name)", %args, params => $q);
991 }
992  
993 0 foreach my $diag ($sub->diagnostics)
994 0 ▶ { next if $manual->inherited($diag);
Branch: 1 branch
BranchTrueFalseTotal
if $manual->inherited($diag) 0 0 0
995 0 my $p = $self->_collectParams($params, diag => $diag->name);
996 0 my $dt = $diag->openDescription;
997 0 $$dt = $self->_markupText($$dt, "$w(" . $diag->type . ")", %args, params => $p);
998 }
999  
1000 0 foreach my $example ($sub->examples)
1001 0 { my $p = $self->_collectParams($params, example => $example->name);
1002 0 my $ex = $example->openDescription;
1003 0 $$ex = $self->_markupText($$ex, "$w(example)", %args, params => $p);
1004 }
1005 }
1006  
1007 0 $self->autoMarkup($manual, $_, %args) for $struct->nest;
1008 }
1009  
1010  
1011 sub finalizeManual($%)
1012 0 ▶{ my ($self, $manual, %args) = @_;
Subroutine finalizeManual: not called CC=5 SCAR=34.0
Pod documented
1013 0 $self->SUPER::finalizeManual($manual, %args);
1014  
1015 my %actions = (
1016 make_p => exists $args{skip_auto_p} ? $args{skip_auto_p} : 1,
1017 make_m => exists $args{skip_auto_m} ? $args{skip_auto_m} : 1,
1018 0 ▶ make_c => $args{wrap_c} || [ qw/undef true false/ ],
Branch: 2 branches
BranchTrueFalseTotal
exists $args{'skip_auto_p'} ? : 0 0 0
exists $args{'skip_auto_m'} ? : 0 0 0
Condition0%0/2
$args{'wrap_c'} || ['undef', 'true', 'false']
l!l
00
MC/DC0%0/1
$args{'wrap_c'} || ['undef', 'true', 'false']
$args{'wrap_c'}
Truth table0%0/2
A
A= $args{'wrap_c'}
Aresult
11
00
1019 );
1020  
1021 0 $self->autoMarkup($manual, $_, %actions) for $manual->chapters;
1022 }
1023  
1024  
1025 sub filenameToPackage($)
1026 0 ▶{ my ($thing, $fn) = @_;
Subroutine filenameToPackage: not called CC=1 SCAR=6.9
Pod documented
1027 0 $fn =~ s!^lib/!!r =~ s#/#::#gr =~ s/\.(?:pm|pod)$//gr;
1028 }
1029  
1030 sub formatReferTo($$)
1031 0 ▶{ my ($self, $manual, $object) = @_;
Subroutine formatReferTo: not called CC=8 SCAR=42.8
Pod documented
1032  
1033 0 ▶ return $manual->name
Branch: 1 branch
BranchTrueFalseTotal
if $object->isa("OODoc::Manual") 0 0 0
1034 if $object->isa('OODoc::Manual');
1035  
1036 0 ▶ return $manual->name . '/"' . $object->name . '"'
Branch: 1 branch
BranchTrueFalseTotal
if $object->isa("OODoc::Text::Structure") 0 0 0
1037 if $object->isa('OODoc::Text::Structure');
1038  
1039 0 ▶ my $page = $object->manual eq $manual ? '' : ($object->manual->name . '::');
Branch: 1 branch
BranchTrueFalseTotal
$object->manual eq $manual ? : 0 0 0
1040  
1041 0 ▶ return $page . $object->name . '()'
Branch: 1 branch
BranchTrueFalseTotal
if $object->isa("OODoc::Text::Subroutine") 0 0 0
1042 if $object->isa('OODoc::Text::Subroutine');
1043  
1044 0 ▶ return $page . $object->subroutine->name . '(' . $object->name . ')'
Branch: 1 branch
BranchTrueFalseTotal
if $object->isa("OODoc::Text::Option") or $object->isa("OODoc::Text::Default") 0 0 0
Condition0%0/3
$object->isa("OODoc::Text::Option") or $object->isa("OODoc::Text::Default")
l!l&&r!l&&!r
000
MC/DC0%0/2
$object->isa("OODoc::Text::Option") or $object->isa("OODoc::Text::Default")
$object->isa("OODoc::Text::Option") $object->isa("OODoc::Text::Default")
Truth table0%0/3
A or B
A= $object->isa("OODoc::Text::Option")B= $object->isa("OODoc::Text::Default")
ABresult
1X1
011
000
1045 if $object->isa('OODoc::Text::Option') || $object->isa('OODoc::Text::Default');
1046  
1047 0 ▶ return $page . $object->subroutine->name . '()'
Branch: 1 branch
BranchTrueFalseTotal
if $object->isa("OODoc::Text::Diagnostic") 0 0 0
1048 if $object->isa('OODoc::Text::Diagnostic');
1049  
1050 0 panic ref $object;
1051  
1052 }
1053  
1054 #--------------------
1055  
1056 1 1;
« lib/OODoc/Format/Html.pm ↑ Summary lib/OODoc/Text/Subroutine.pm »