lib/OODoc/Text.pm

filter: Statementstmt 33.3% 21 / 63 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 26.0% 6 / 23 Podpod 91.6% 11 / 12 totaltotal 29.0% 38 / 131 SCAR 46.4
CC
14
Cov
23%
init
42.0
description
30.0
findDescriptionObject
12.0
CRAP 103.2
« lib/OODoc/Text/Chapter.pm ↑ Summary lib/OODoc/Text/Section.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;
9 1 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 $VERSION = '2.02';
11  
12 1 ▶use base 'OODoc::Object';
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  
19  
20 0 ▶use overload '==' => sub {$_[0]->unique == $_[1]->unique}
Subroutine __ANON__: not called CC=1 SCAR=6.9
21 0 ▶ , '!=' => sub {$_[0]->unique != $_[1]->unique}
Subroutine __ANON__: not called CC=1 SCAR=6.9
22 0 ▶ , '""' => sub {$_[0]->name}
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 0 ▶ , 'cmp' => sub {$_[0]->name cmp "$_[1]"}
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 1 ▶ , 'bool' => sub {1};
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine __ANON__: not called CC=1 SCAR=0.2
25  
26 #-------------------------------------------
27  
28  
29 1 my $unique = 1;
30  
31 sub init($)
32 0 ▶{ my ($self, $args) = @_;
Subroutine init: not called CC=6 SCAR=37.4
Pod undocumented
33 0 ▶ $self->SUPER::init($args) or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init($args) or return 0 0 0
34  
35 0 $self->{OT_name} = delete $args->{name};
36  
37 0 ▶ my $nr = $self->{OT_linenr} = delete $args->{linenr} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $nr = $self->{"OT_linenr"} = delete $args->{"linenr"} or &panic() 0 0 0
38 0 ▶ $self->{OT_type} = delete $args->{type} or panic;
Branch: 1 branch
BranchTrueFalseTotal
$self->{"OT_type"} = delete $args->{"type"} or &panic() 0 0 0
39  
40 exists $args->{container} # may be explicit undef
41 0 ▶ or panic "no text container specified for the {pkg} object"
Branch: 1 branch
BranchTrueFalseTotal
exists $args->{"container"} or &panic("no text container specified for the {pkg} object", "pkg", ref $self) 0 0 0
42 , pkg => ref $self;
43  
44 # may be undef
45 0 $self->{OT_container}= delete $args->{container};
46  
47 0 ▶ $self->{OT_descr} = delete $args->{description} || '';
Condition0%0/2
delete $args->{'description'} || ''
l!l
00
MC/DC0%0/1
delete $args->{'description'} || ''
delete $args->{'description'}
Truth table0%0/2
A
A= delete $args->{'description'}
Aresult
11
00
48 0 $self->{OT_examples} = [];
49 0 $self->{OT_unique} = $unique++;
50  
51 0 $self;
52 }
53  
54 #-------------------------------------------
55  
56  
57 0 ▶sub name() {shift->{OT_name}}
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
58  
59  
60 0 ▶sub type() {shift->{OT_type}}
Subroutine type: not called CC=1 SCAR=6.9
Pod documented
61  
62  
63 sub description()
64 0 ▶{ my $text = shift->{OT_descr};
Subroutine description: not called CC=5 SCAR=34.0
Pod documented
65 0 my @lines = split /^/m, $text;
66 0 ▶ shift @lines while @lines && $lines[ 0] =~ m/^\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
@lines and $lines[0] =~ /^\s*$/ and do { shift @lines } 0 0 0
Condition0%0/3
@lines and $lines[0] =~ /^\s*$/
!ll&&!rl&&r
000
MC/DC0%0/2
@lines and $lines[0] =~ /^\s*$/
@lines $lines[0] =~ /^\s*$/
Truth table0%0/3
A and B
A= @linesB= $lines[0] =~ /^\s*$/
ABresult
0X0
100
111
67 0 ▶ pop @lines while @lines && $lines[-1] =~ m/^\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
@lines and $lines[-1] =~ /^\s*$/ and do { pop @lines } 0 0 0
Condition0%0/3
@lines and $lines[-1] =~ /^\s*$/
!ll&&!rl&&r
000
MC/DC0%0/2
@lines and $lines[-1] =~ /^\s*$/
@lines $lines[-1] =~ /^\s*$/
Truth table0%0/3
A and B
A= @linesB= $lines[-1] =~ /^\s*$/
ABresult
0X0
100
111
68 0 join '', @lines;
69 }
70  
71  
72 sub container(;$)
73 0 ▶{ my $self = shift;
Subroutine container: not called CC=2 SCAR=17.9
Pod documented
74 0 ▶ @_ ? ($self->{OT_container} = shift) : $self->{OT_container};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
75 }
76  
77  
78 sub manual(;$)
79 0 ▶{ my $self = shift;
Subroutine manual: not called CC=2 SCAR=17.9
Pod documented
80 0 ▶ @_ ? $self->SUPER::manual(@_)
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
81 : $self->container->manual;
82 }
83  
84  
85 0 ▶sub unique() {shift->{OT_unique}}
Subroutine unique: not called CC=1 SCAR=6.9
Pod documented
86  
87  
88 sub where()
89 0 ▶{ my $self = shift;
Subroutine where: not called CC=1 SCAR=6.9
Pod documented
90 0 ($self->manual->source, $self->{OT_linenr});
91 }
92  
93 #-------------------------------------------
94  
95  
96 0 ▶sub openDescription() { \shift->{OT_descr} }
Subroutine openDescription: not called CC=1 SCAR=6.9
Pod documented
97  
98  
99 sub findDescriptionObject()
100 0 ▶{ my $self = shift;
Subroutine findDescriptionObject: not called CC=3 SCAR=24.8
Pod documented
101 0 ▶ return $self if length $self->description;
Branch: 1 branch
BranchTrueFalseTotal
if length $self->description 0 0 0
102  
103 0 my @descr = map { $_->findDescriptionObject } $self->extends;
104 0 ▶ wantarray ? @descr : $descr[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
105 }
106  
107  
108 sub example($)
109 0 ▶{ my ($self, $example) = @_;
Subroutine example: not called CC=1 SCAR=6.9
Pod documented
110 0 push @{$self->{OT_examples}}, $example;
111 0 $example;
112 }
113  
114  
115 0 ▶sub examples() { @{shift->{OT_examples}} }
Subroutine examples: not called CC=1 SCAR=6.9
Pod documented
116  
117 #-------------------------------------------
118  
119  
120 1 1;
« lib/OODoc/Text/Chapter.pm ↑ Summary lib/OODoc/Text/Section.pm »