File Coverage

blib/lib/StatusBoard/Graph/DataSeq.pm
Criterion Covered Total %
statement 30 41 73.1
branch 4 12 33.3
condition n/a
subroutine 9 12 75.0
pod 8 8 100.0
total 51 73 69.8


line stmt bran cond sub pod time code
1             package StatusBoard::Graph::DataSeq;
2             {
3             $StatusBoard::Graph::DataSeq::VERSION = '1.0.1';
4             }
5              
6             # ABSTRACT: datasequences representation for the StatusBoard::Graph
7              
8              
9 1     1   2037 use strict;
  1         3  
  1         52  
10 1     1   41 use warnings;
  1         2  
  1         35  
11 1     1   5 use utf8;
  1         2  
  1         11  
12              
13 1     1   24 use Carp;
  1         2  
  1         736  
14              
15             my $true = 1;
16             my $false = '';
17              
18              
19             sub new {
20 2     2 1 13 my ($class, %opts) = @_;
21              
22 2 50       7 croak "Constructor new() does not need any parameters." if %opts;
23              
24 2         4 my $self = {};
25 2         5 bless $self, $class;
26              
27 2         5 return $self;
28             }
29              
30              
31             sub set_title {
32 2     2 1 10 my ($self, $title) = @_;
33              
34 2         10 $self->{__title} = $title;
35              
36 2         4 return $false;
37             }
38              
39              
40             sub get_title {
41 0     0 1 0 my ($self) = @_;
42              
43 0 0       0 croak "No title. Stopped" if not defined $self->{__title};
44              
45 0         0 return $self->{__title};
46             }
47              
48              
49             sub set_color {
50 0     0 1 0 my ($self, $color) = @_;
51              
52 0         0 $self->{__color} = $color;
53              
54 0         0 return $false;
55             }
56              
57              
58             sub has_color {
59 2     2 1 3 my ($self) = @_;
60              
61 2 50       15 return defined($self->{__color}) ? $true : $false;
62             }
63              
64              
65             sub get_color {
66 0     0 1 0 my ($self) = @_;
67              
68 0 0       0 croak "No color. Stopped" if not $self->has_color();
69              
70 0         0 return $self->{__color};
71             }
72              
73              
74             sub set_values {
75 2     2 1 12 my ($self, $values) = @_;
76              
77 2 50       8 if (ref $values ne 'ARRAY') {
78 0         0 croak "Incorrect values. Stopped";
79             }
80              
81 2         3 $self->{__values} = $values;
82              
83 2         5 return $false;
84             }
85              
86              
87             sub get_values {
88 2     2 1 3 my ($self) = @_;
89              
90 2         4 my $v = $self->{__values};
91              
92 2 50       6 if (not defined $v) {
93 0         0 croak "No values in StatusBoard::Graph::DataSeq. Stopped";
94             }
95              
96 2         41 return $self->{__values};
97             }
98              
99              
100             1;
101              
102             __END__