Graph/Data/Datum.pm

filter: Statementstmt 74.0% 20 / 27 Branchbran 50.0% 6 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 100% 7 / 7 totaltotal 72.2% 39 / 54 CC 8 SCAR 14.8
CC
8
Cov
67%
check
12.0
label
6.0
init
2.0
CRAP 4.4
« Graph/Glyph/tree.pm ↑ Summary Graph/Glyph/barflex.pm »
1 package SVG::Graph::Data::Datum;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 #use overload
5 # '""' => \&label,
6 # '<=>' => sub { my($x,$y) = &check; $x <=> $y },
7 # '+' => sub { my($x,$y) = &check; $x+$y },
8 # '-' => sub { my($x,$y) = &check; $x-$y },
9 # '*' => sub { my($x,$y) = &check; $x*$y },
10 # '/' => sub { my($x,$y) = &check; $x/$y },
11 # ;
12  
13 =head2 new
14  
15 Title : new
16 Usage :
17 Function:
18 Example :
19 Returns :
20 Args :
21  
22  
23 =cut
24  
25 180 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
26 180 my($class, %args) = @_;
27 180 my $self = bless {}, $class;
28 180 $self->init(%args);
29 180 return $self;
30 }
31  
32 =head2 init
33  
34 Title : init
35 Usage :
36 Function:
37 Example :
38 Returns :
39 Args :
40  
41  
42 =cut
43  
44 180 ▶sub init {
Subroutine init: called CC=2 SCAR=6.9
Pod documented
45 180 my($self, %args) = @_;
46 180 foreach my $arg (keys %args) {
47 540 $self->$arg($args{$arg});
48 }
49 }
50  
51 =head2 x
52  
53 Title : x
54 Usage :
55 Function:
56 Example :
57 Returns :
58 Args :
59  
60  
61 =cut
62  
63 836 ▶sub x {
Subroutine x: called CC=2 SCAR=6.9
Pod documented
64 836 my($self,$arg) = @_;
65 836 ▶ $self->{x} = $arg if defined $arg;
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg 180 656 836
66 836 return $self->{x};
67 }
68  
69 =head2 y
70  
71 Title : y
72 Usage :
73 Function:
74 Example :
75 Returns :
76 Args :
77  
78  
79 =cut
80  
81 500 ▶sub y {
Subroutine y: called CC=2 SCAR=6.9
Pod documented
82 500 my($self,$arg) = @_;
83 500 ▶ $self->{y} = $arg if defined $arg;
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg 180 320 500
84 500 return $self->{y};
85 }
86  
87 =head2 z
88  
89 Title : z
90 Usage :
91 Function:
92 Example :
93 Returns :
94 Args :
95  
96  
97 =cut
98  
99 440 ▶sub z {
Subroutine z: called CC=2 SCAR=6.9
Pod documented
100 440 my($self,$arg) = @_;
101 440 ▶ $self->{z} = $arg if defined $arg;
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg 180 260 440
102 440 return $self->{z};
103 }
104  
105 =head2 label
106  
107 Title : label
108 Usage :
109 Function:
110 Example :
111 Returns :
112 Args :
113  
114  
115 =cut
116  
117 0 ▶sub label {
Subroutine label: not called CC=2 SCAR=17.9
Pod documented
118 0 my($self,$arg) = @_;
119 0 ▶ $self->{label} = $arg if defined $arg;
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg 0 0 0
120 0 return $self->{label};
121 }
122  
123 =head2 check
124  
125 Title : check
126 Usage :
127 Function:
128 Example :
129 Returns :
130 Args :
131  
132  
133 =cut
134  
135 0 ▶sub check {
Subroutine check: not called CC=3 SCAR=24.8
Pod documented
136 0 my($x,$y) = @_;
137  
138 0 ▶ $x = $x->x if ref $x eq __PACKAGE__;
Branch: 1 branch
BranchTrueFalseTotal
if ref $x eq __PACKAGE__ 0 0 0
139 0 ▶ $y = $y->x if ref $y eq __PACKAGE__;
Branch: 1 branch
BranchTrueFalseTotal
if ref $y eq __PACKAGE__ 0 0 0
140  
141 0 return($x,$y);
142 }
143  
144 6 1;
« Graph/Glyph/tree.pm ↑ Summary Graph/Glyph/barflex.pm »