Graph/Data/Tree.pm

filter: Statementstmt 86.9% 20 / 23 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 5 / 5 totaltotal 89.1% 33 / 37 CC 3 SCAR 4.5
CC
3
Cov
88%
init
2.0
depth
2.0
root
2.0
CRAP 1.6
« Graph.pm ↑ Summary Graph/Glyph/bubble.pm »
1 package SVG::Graph::Data::Tree;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use SVG::Graph::Data::Node;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =head2 new
7  
8 Title : new
9 Usage :
10 Function:
11 Example :
12 Returns :
13 Args :
14  
15  
16 =cut
17  
18 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
19 1 my($class, @args) = @_;
20 1 my $self = bless {}, $class;
21 1 $self->init(@args);
22 1 return $self;
23 }
24  
25 =head2 init
26  
27 Title : init
28 Usage :
29 Function:
30 Example :
31 Returns :
32 Args :
33  
34  
35 =cut
36  
37 1 ▶sub init {
Subroutine init: called CC=2 SCAR=7.1
Pod documented
38 1 my($self, %args) = @_;
39  
40 1 $self->root(SVG::Graph::Data::Node->new);
41 1 $self->root->name('root');
42  
43 1 foreach my $arg (keys %args) {
44 0 $self->$arg($args{$arg});
45 }
46 }
47  
48 =head2 depth
49  
50 Title : depth
51 Usage :
52 Function:
53 Example :
54 Returns :
55 Args :
56  
57  
58 =cut
59  
60 0 ▶sub depth{
Subroutine depth: not called CC=1 SCAR=6.9
Pod documented
61 0 my ($self,@args) = @_;
62  
63 0 return $self->root->depth;
64 }
65  
66 =head2 root
67  
68 Title : root
69 Usage : $obj->root($newval)
70 Function:
71 Example :
72 Returns : value of root (a scalar)
73 Args : on set, new value (a scalar or undef, optional)
74  
75  
76 =cut
77  
78 4 ▶sub root{
Subroutine root: called CC=2 SCAR=6.9
Pod documented
79 4 my $self = shift;
80  
81 4 ▶ return $self->{'root'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 1 3 4
82 3 return $self->{'root'};
83 }
84  
85 =head2 new_node
86  
87 Title : new_node
88 Usage :
89 Function:
90 Example :
91 Returns :
92 Args :
93  
94  
95 =cut
96  
97 21 ▶sub new_node{
Subroutine new_node: called CC=1 SCAR=0.0
Pod documented
98 21 my ($self,@args) = @_;
99  
100 21 return SVG::Graph::Data::Node->new(@args);
101 }
102  
103 1 1;
« Graph.pm ↑ Summary Graph/Glyph/bubble.pm »