| 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::Text::Chapter;{ | ||||||||||||||||||||||||||||
| 13 | 1 | our $VERSION = '3.05'; | |||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use parent 'OODoc::Text::Structure'; | ||||||||||||||||||||||||||
|
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 List::Util qw/first/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | #-------------------- | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | sub init($) | ||||||||||||||||||||||||||||
| 28 | 0 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
init: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | $args->{type} ||= 'Chapter'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args->{"type"} ||= "Chapter"
MC/DC0%0/1
$args->{"type"} ||= "Chapter"
$args->{"type"}
Truth table0%0/2
A
A= $args->{"type"}
| |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | $args->{container} ||= delete $args->{manual} or panic; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args->{"container"} ||= delete $args->{"manual"}
MC/DC0%0/2
$args->{"container"} ||= delete $args->{"manual"}
$args->{"container"}
delete $args->{"manual"}
Truth table0%0/3
A ||= B
A= $args->{"container"}B= delete $args->{"manual"}
| |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | $args->{level} ||= 1; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args->{"level"} ||= 1
MC/DC0%0/1
$args->{"level"} ||= 1
$args->{"level"}
Truth table0%0/2
A
A= $args->{"level"}
| |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | $self->SUPER::init($args) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 0 | $self->{OTC_sections} = []; | |||||||||||||||||||||||||||
| 34 | 0 | $self; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | sub emptyExtension($) | ||||||||||||||||||||||||||||
| 38 | 0 | ▶ | { my ($self, $container) = @_; | ||||||||||||||||||||||||||
|
Subroutine
emptyExtension: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 39 | 0 | my $empty = $self->SUPER::emptyExtension($container); | |||||||||||||||||||||||||||
| 40 | 0 | my @sections = map $_->emptyExtension($empty), $self->sections; | |||||||||||||||||||||||||||
| 41 | 0 | $empty->sections(@sections); | |||||||||||||||||||||||||||
| 42 | 0 | $empty; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub manual() { $_[0]->container } | ||||||||||||||||||||||||||
|
Subroutine
manual: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub path() { $_[0]->name } | ||||||||||||||||||||||||||
|
Subroutine
path: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | sub findSubroutine($) | ||||||||||||||||||||||||||||
| 49 | 0 | ▶ | { my ($self, $name) = @_; | ||||||||||||||||||||||||||
|
Subroutine
findSubroutine: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 50 | 0 | my $sub = $self->SUPER::findSubroutine($name); | |||||||||||||||||||||||||||
| 51 | 0 | ▶ | return $sub if defined $sub; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | foreach my $section ($self->sections) | |||||||||||||||||||||||||||
| 54 | 0 | { my $sub = $section->findSubroutine($name); | |||||||||||||||||||||||||||
| 55 | 0 | ▶ | return $sub if defined $sub; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | undef; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | sub findEntry($) | ||||||||||||||||||||||||||||
| 62 | 0 | ▶ | { my ($self, $name) = @_; | ||||||||||||||||||||||||||
|
Subroutine
findEntry: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | return $self if $self->name eq $name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | foreach my $section ($self->sections) | |||||||||||||||||||||||||||
| 66 | 0 | { my $entry = $section->findEntry($name); | |||||||||||||||||||||||||||
| 67 | 0 | ▶ | return $entry if defined $entry; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 0 | (); | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | sub all($@) | ||||||||||||||||||||||||||||
| 74 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
all: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 75 | 0 | ( $self->SUPER::all(@_), | |||||||||||||||||||||||||||
| 76 | (map $_->all(@_), $self->sections), | ||||||||||||||||||||||||||||
| 77 | ); | ||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | #-------------------- | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | sub section($) | ||||||||||||||||||||||||||||
| 83 | 0 | ▶ | { my ($self, $thing) = @_; | ||||||||||||||||||||||||||
|
Subroutine
section: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if(ref $thing) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | 0 | { push @{$self->{OTC_sections}}, $thing; | |||||||||||||||||||||||||||
| 87 | 0 | return $thing; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 0 | ▶ | first { $_->name eq $thing } $self->sections; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | sub sections() | ||||||||||||||||||||||||||||
| 95 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
sections: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if(@_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | 0 | { $self->{OTC_sections} = [ @_ ]; | |||||||||||||||||||||||||||
| 98 | 0 | $_->container($self) for @_; | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | 0 | @{$self->{OTC_sections}}; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 1 | *nest = \*sections; | |||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 1 | 1; | |||||||||||||||||||||||||||