File Coverage

blib/lib/XML/Mini/TreeComponent.pm
Criterion Covered Total %
statement 24 44 54.5
branch 2 6 33.3
condition 0 8 0.0
subroutine 7 12 58.3
pod 3 7 42.8
total 36 77 46.7


line stmt bran cond sub pod time code
1             package XML::Mini::TreeComponent;
2 10     10   56 use strict;
  10         19  
  10         463  
3             $^W = 1;
4              
5 10     10   21919 use Data::Dumper;
  10         108200  
  10         812  
6 10     10   110 use XML::Mini;
  10         22  
  10         238  
7              
8 10     10   52 use vars qw ( $VERSION );
  10         19  
  10         5326  
9             $VERSION = '1.28';
10              
11             sub new
12             {
13 0     0 0 0 my $class = shift;
14 0         0 my $self = {};
15 0   0     0 bless $self, ref $class || $class;
16 0         0 return $self;
17             }
18              
19             sub name
20             {
21 2     2 0 4 my $self = shift;
22 2         3 my $setTo = shift; # optionally set
23 2         6 return undef;
24             }
25              
26             sub getElement
27             {
28 2     2 0 3 my $self = shift;
29 2         3 my $name = shift;
30 2         5 return undef;
31             }
32              
33             sub getValue
34             {
35 0     0 0 0 my $self = shift;
36 0         0 return undef;
37             }
38              
39             sub parent
40             {
41 0     0 1 0 my $self = shift;
42 0         0 my $newParent = shift; # optionally set
43            
44 0 0       0 if ($newParent)
45             {
46 0         0 my $ownType = ref $self;
47 0         0 my $type = ref $newParent;
48 0 0 0     0 if ($type && $type =~ /^$ownType/)
49             {
50 0         0 $self->{'_parent'} = $newParent;
51             } else {
52 0         0 return XML::Mini->Error("XML::MiniTreeComponent::parent(): Must pass an instance derived from "
53             . "XML::MiniTreeComponent to set.");
54             }
55             }
56 0         0 return $self->{'_parent'};
57             }
58              
59             sub toString
60             {
61 0     0 1 0 my $self = shift;
62 0   0     0 my $depth = shift || 0;
63 0         0 return undef;
64             }
65              
66             sub dump
67             {
68 0     0 1 0 my $self = shift;
69 0         0 return Dumper($self);
70             }
71              
72             sub _spaceStr
73             {
74 150     150   173 my $self = shift;
75 150         174 my $numSpaces = shift;
76 150         164 my $retStr = '';
77 150 100       305 if ($numSpaces)
78             {
79 146         228 $retStr = ' ' x $numSpaces;
80             }
81 150         437 return $retStr;
82             }
83              
84             1;
85              
86             __END__