File Coverage

lib/OODoc/Text/SubSection.pm
Criterion Covered Total %
statement 15 47 31.9
branch 0 10 0.0
condition 0 7 0.0
subroutine 5 13 38.4
pod 7 8 87.5
total 27 85 31.7


line stmt bran cond sub pod time code
1             # Copyrights 2003-2013 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.00.
5              
6             package OODoc::Text::SubSection;
7 1     1   598 use vars '$VERSION';
  1         3  
  1         55  
8             $VERSION = '2.00';
9              
10 1     1   5 use base 'OODoc::Text::Structure';
  1         1  
  1         379  
11              
12 1     1   5 use strict;
  1         1  
  1         24  
13 1     1   4 use warnings;
  1         2  
  1         22  
14              
15 1     1   4 use Log::Report 'oodoc';
  1         1  
  1         22  
16              
17              
18             sub init($)
19 0     0 0   { my ($self, $args) = @_;
20 0   0       $args->{type} ||= 'Subsection';
21 0 0 0       $args->{container} ||= delete $args->{section} or panic;
22 0   0       $args->{level} ||= 3;
23              
24 0 0         $self->SUPER::init($args) or return;
25 0           $self->{OTS_subsubsections} = [];
26 0           $self;
27             }
28              
29             sub emptyExtension($)
30 0     0 1   { my ($self, $container) = @_;
31 0           my $empty = $self->SUPER::emptyExtension($container);
32 0           my @subsub = map {$_->emptyExtension($empty)} $self->subsubsections;
  0            
33 0           $empty->subsubsections(@subsub);
34 0           $empty;
35             }
36              
37             sub findEntry($)
38 0     0 1   { my ($self, $name) = @_;
39 0 0         $self->name eq $name ? $self : ();
40             }
41              
42             #-------------------------------------------
43              
44              
45 0     0 1   sub section() { shift->container }
46              
47              
48 0     0 1   sub chapter() { shift->section->chapter }
49              
50             sub path()
51 0     0 1   { my $self = shift;
52 0           $self->section->path . '/' . $self->name;
53             }
54              
55             #-------------------------------------------
56              
57              
58             sub subsubsection($)
59 0     0 1   { my ($self, $thing) = @_;
60              
61 0 0         if(ref $thing)
62 0           { push @{$self->{OTS_subsubsections}}, $thing;
  0            
63 0           return $thing;
64             }
65              
66 0           first {$_->name eq $thing} $self->subsubsections;
  0            
67             }
68              
69              
70             sub subsubsections(;@)
71 0     0 1   { my $self = shift;
72 0 0         if(@_)
73 0           { $self->{OTS_subsubsections} = [ @_ ];
74 0           $_->container($self) for @_;
75             }
76              
77 0           @{$self->{OTS_subsubsections}};
  0            
78             }
79              
80              
81             1;
82              
83             1;