| 1 | # Copyrights 2003-2015 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.01. | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | package OODoc::Text::Section; | ||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | $VERSION = '2.01'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use base 'OODoc::Text::Structure'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Log::Report 'oodoc'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use List::Util 'first'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | sub init($) | ||||||||||||||||||||||||||||
| 21 | 0 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
init: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | $args->{type} ||= 'Section'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args->{"type"} ||= "Section"
MC/DC0%0/1
$args->{"type"} ||= "Section"
$args->{"type"}
Truth table0%0/2
A
A= $args->{"type"}
| |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | $args->{level} ||= 2; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args->{"level"} ||= 2
MC/DC0%0/1
$args->{"level"} ||= 2
$args->{"level"}
Truth table0%0/2
A
A= $args->{"level"}
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | $args->{container} ||= delete $args->{chapter} or panic; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args->{"container"} ||= delete $args->{"chapter"}
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"}
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | $self->SUPER::init($args) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | $self->{OTS_subsections} = []; | |||||||||||||||||||||||||||
| 29 | 0 | $self; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | sub emptyExtension($) | ||||||||||||||||||||||||||||
| 33 | 0 | ▶ | { my ($self, $container) = @_; | ||||||||||||||||||||||||||
|
Subroutine
emptyExtension: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 34 | 0 | my $empty = $self->SUPER::emptyExtension($container); | |||||||||||||||||||||||||||
| 35 | 0 | my @subsections = map $_->emptyExtension($empty), $self->subsections; | |||||||||||||||||||||||||||
| 36 | 0 | $empty->subsections(@subsections); | |||||||||||||||||||||||||||
| 37 | 0 | $empty; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | #------------------------------------------- | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | sub chapter() { shift->container } | ||||||||||||||||||||||||||
|
Subroutine
chapter: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | sub path() | ||||||||||||||||||||||||||||
| 46 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
path: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | 0 | $self->chapter->path . '/' . $self->name; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | sub findSubroutine($) | ||||||||||||||||||||||||||||
| 51 | 0 | ▶ | { my ($self, $name) = @_; | ||||||||||||||||||||||||||
|
Subroutine
findSubroutine: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 52 | 0 | my $sub = $self->SUPER::findSubroutine($name); | |||||||||||||||||||||||||||
| 53 | 0 | ▶ | return $sub if defined $sub; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | foreach my $subsection ($self->subsections) | |||||||||||||||||||||||||||
| 56 | 0 | { my $sub = $subsection->findSubroutine($name); | |||||||||||||||||||||||||||
| 57 | 0 | ▶ | return $sub if defined $sub; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | undef; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | sub findEntry($) | ||||||||||||||||||||||||||||
| 64 | 0 | ▶ | { my ($self, $name) = @_; | ||||||||||||||||||||||||||
|
Subroutine
findEntry: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | return $self if $self->name eq $name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 0 | my $subsect = $self->subsection($name); | |||||||||||||||||||||||||||
| 67 | 0 | ▶ | defined $subsect ? $subsect : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | sub all($@) | ||||||||||||||||||||||||||||
| 71 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
all: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 72 | 0 | ($self->SUPER::all(@_), map {$_->all(@_)} $self->subsections); | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | #------------------------------------------- | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | sub subsection($) | ||||||||||||||||||||||||||||
| 79 | 0 | ▶ | { my ($self, $thing) = @_; | ||||||||||||||||||||||||||
|
Subroutine
subsection: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if(ref $thing) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | 0 | { push @{$self->{OTS_subsections}}, $thing; | |||||||||||||||||||||||||||
| 82 | 0 | return $thing; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 0 | ▶ | first {$_->name eq $thing} $self->subsections; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | sub subsections(;@) | ||||||||||||||||||||||||||||
| 90 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
subsections: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 91 | 0 | ▶ | if(@_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 0 | { $self->{OTS_subsections} = [ @_ ]; | |||||||||||||||||||||||||||
| 93 | 0 | $_->container($self) for @_; | |||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | @{$self->{OTS_subsections}}; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 1 | 1; | |||||||||||||||||||||||||||