lib/OODoc/Text/Section.pm

filter: Statementstmt 32.2% 20 / 62 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 37.5% 6 / 16 Podpod 77.7% 7 / 9 totaltotal 28.9% 33 / 114 SCAR 46.2
CC
14
Cov
24%
init
42.0
findSubroutine
20.0
findEntry
12.0
CRAP 101.6
« lib/OODoc/Text.pm ↑ Summary blib/lib/OODoc/Format/Pod3.pm »
1 # Copyrights 2003-2021 by [Mark Overmeer].
2 # For other contributors see ChangeLog.
3 # See the manual pages for details on the licensing terms.
4 # Pod stripped from pm file by OODoc 2.02.
5 # This code is part of perl distribution OODoc. It is licensed under the
6 # same terms as Perl itself: https://spdx.org/licenses/Artistic-2.0.html
7  
8 package OODoc::Text::Section;
9 1 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 $VERSION = '2.02';
11  
12 1 ▶use base 'OODoc::Text::Structure';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use Log::Report 'oodoc';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use List::Util 'first';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20  
21 sub init($)
22 0 ▶{ my ($self, $args) = @_;
Subroutine init: not called CC=6 SCAR=37.4
Pod undocumented
23 0 ▶ $args->{type} ||= 'Section';
Condition0%0/2
$args->{"type"} ||= "Section"
l!l
00
MC/DC0%0/1
$args->{"type"} ||= "Section"
$args->{"type"}
Truth table0%0/2
A
A= $args->{"type"}
Aresult
11
00
24 0 ▶ $args->{level} ||= 2;
Condition0%0/2
$args->{"level"} ||= 2
l!l
00
MC/DC0%0/1
$args->{"level"} ||= 2
$args->{"level"}
Truth table0%0/2
A
A= $args->{"level"}
Aresult
11
00
25 0 ▶ $args->{container} ||= delete $args->{chapter} or panic;
Branch: 1 branch
BranchTrueFalseTotal
$args->{"container"} ||= delete $args->{"chapter"} or &panic() 0 0 0
Condition0%0/3
$args->{"container"} ||= delete $args->{"chapter"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{"container"} ||= delete $args->{"chapter"}
$args->{"container"} delete $args->{"chapter"}
Truth table0%0/3
A ||= B
A= $args->{"container"}B= delete $args->{"chapter"}
ABresult
1X1
011
000
26  
27 0 ▶ $self->SUPER::init($args) or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init($args) or return 0 0 0
28  
29 0 $self->{OTS_subsections} = [];
30 0 $self;
31 }
32  
33 sub emptyExtension($)
34 0 ▶{ my ($self, $container) = @_;
Subroutine emptyExtension: not called CC=1 SCAR=6.9
Pod documented
35 0 my $empty = $self->SUPER::emptyExtension($container);
36 0 my @subsections = map $_->emptyExtension($empty), $self->subsections;
37 0 $empty->subsections(@subsections);
38 0 $empty;
39 }
40  
41 #-------------------------------------------
42  
43  
44 0 ▶sub chapter() { shift->container }
Subroutine chapter: not called CC=1 SCAR=6.9
Pod documented
45  
46 sub path()
47 0 ▶{ my $self = shift;
Subroutine path: not called CC=1 SCAR=6.9
Pod documented
48 0 $self->chapter->path . '/' . $self->name;
49 }
50  
51 sub findSubroutine($)
52 0 ▶{ my ($self, $name) = @_;
Subroutine findSubroutine: not called CC=4 SCAR=30.0
Pod undocumented
53 0 my $sub = $self->SUPER::findSubroutine($name);
54 0 ▶ return $sub if defined $sub;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sub 0 0 0
55  
56 0 foreach my $subsection ($self->subsections)
57 0 { my $sub = $subsection->findSubroutine($name);
58 0 ▶ return $sub if defined $sub;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sub 0 0 0
59 }
60  
61 0 undef;
62 }
63  
64 sub findEntry($)
65 0 ▶{ my ($self, $name) = @_;
Subroutine findEntry: not called CC=3 SCAR=24.8
Pod documented
66 0 ▶ return $self if $self->name eq $name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->name eq $name 0 0 0
67 0 my $subsect = $self->subsection($name);
68 0 ▶ defined $subsect ? $subsect : ();
Branch: 1 branch
BranchTrueFalseTotal
defined $subsect ? : 0 0 0
69 }
70  
71 sub all($@)
72 0 ▶{ my $self = shift;
Subroutine all: not called CC=1 SCAR=6.9
Pod documented
73 0 ($self->SUPER::all(@_), map {$_->all(@_)} $self->subsections);
74 }
75  
76 #-------------------------------------------
77  
78  
79 sub subsection($)
80 0 ▶{ my ($self, $thing) = @_;
Subroutine subsection: not called CC=2 SCAR=17.9
Pod documented
81 0 ▶ if(ref $thing)
Branch: 1 branch
BranchTrueFalseTotal
if (ref $thing) 0 0 0
82 0 { push @{$self->{OTS_subsections}}, $thing;
83 0 return $thing;
84 }
85  
86 0 ▶ first {$_->name eq $thing} $self->subsections;
Subroutine __ANON__: not called CC=1 SCAR=6.9
87 }
88  
89  
90 sub subsections(;@)
91 0 ▶{ my $self = shift;
Subroutine subsections: not called CC=3 SCAR=24.8
Pod documented
92 0 ▶ if(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
93 0 { $self->{OTS_subsections} = [ @_ ];
94 0 $_->container($self) for @_;
95 }
96  
97 0 @{$self->{OTS_subsections}};
98 }
99  
100  
101 1 1;
« lib/OODoc/Text.pm ↑ Summary blib/lib/OODoc/Format/Pod3.pm »