blib/lib/OODoc/Text/SubSection.pm untested

filter: Statementstmt 0.0% 0 / 49 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 12 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 88 CC 4 SCAR 12.5
CC
4
Cov
0%
findEntry
6.0
subsubsection
6.0
subsubsections
6.0
CRAP 3.5
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::SubSection;
7 use vars '$VERSION';
8 $VERSION = '2.01';
9  
10 use base 'OODoc::Text::Structure';
11  
12 use strict;
13 use warnings;
14  
15 use Log::Report 'oodoc';
16  
17  
18 sub init($)
19 { my ($self, $args) = @_;
20 $args->{type} ||= 'Subsection';
21 $args->{container} ||= delete $args->{section} or panic;
22 $args->{level} ||= 3;
23  
24 $self->SUPER::init($args) or return;
25 $self->{OTS_subsubsections} = [];
26 $self;
27 }
28  
29 sub emptyExtension($)
30 { my ($self, $container) = @_;
31 my $empty = $self->SUPER::emptyExtension($container);
32 my @subsub = map $_->emptyExtension($empty), $self->subsubsections;
33 $empty->subsubsections(@subsub);
34 $empty;
35 }
36  
37 sub findEntry($)
38 { my ($self, $name) = @_;
39 $self->name eq $name ? $self : ();
40 }
41  
42 #-------------------------------------------
43  
44  
45 sub section() { shift->container }
46  
47  
48 sub chapter() { shift->section->chapter }
49  
50 sub path()
51 { my $self = shift;
52 $self->section->path . '/' . $self->name;
53 }
54  
55 #-------------------------------------------
56  
57  
58 sub subsubsection($)
59 { my ($self, $thing) = @_;
60  
61 if(ref $thing)
62 { push @{$self->{OTS_subsubsections}}, $thing;
63 return $thing;
64 }
65  
66 first {$_->name eq $thing} $self->subsubsections;
67 }
68  
69  
70 sub subsubsections(;@)
71 { my $self = shift;
72 if(@_)
73 { $self->{OTS_subsubsections} = [ @_ ];
74 $_->container($self) for @_;
75 }
76  
77 @{$self->{OTS_subsubsections}};
78 }
79  
80  
81 1;
82  
83 1;