File Coverage

blib/lib/Chart/Graph/Xmgrace/Dataset.pm
Criterion Covered Total %
statement 16 17 94.1
branch 3 4 75.0
condition 3 9 33.3
subroutine 3 3 100.0
pod 0 1 0.0
total 25 34 73.5


line stmt bran cond sub pod time code
1             #
2             # Dataset.pm holds essential "ingredients" to each Xmgrace dataset.
3             #
4             ## This software product is developed by Esmond Lee and David Moore,
5             ## and copyrighted(C) 1998 by the University of California, San Diego
6             ## (UCSD), with all rights reserved. UCSD administers the CAIDA grant,
7             ## NCR-9711092, under which part of this code was developed.
8             ##
9             ## There is no charge for this software. You can redistribute it and/or
10             ## modify it under the terms of the GNU General Public License, v. 2 dated
11             ## June 1991 which is incorporated by reference herein. This software is
12             ## distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF MERCHANTABILITY
13             ## OR FITNESS FOR A PARTICULAR PURPOSE or that the use of it will not
14             ## infringe on any third party's intellectual property rights.
15             ##
16             ## You should have received a copy of the GNU GPL along with this program.
17             ##
18             ##
19             ## IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
20             ## PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
21             ## DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS
22             ## SOFTWARE, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF
23             ## THE POSSIBILITY OF SUCH DAMAGE.
24             ##
25             ## THE SOFTWARE PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND THE
26             ## UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
27             ## SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. THE UNIVERSITY
28             ## OF CALIFORNIA MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES
29             ## OF ANY KIND, EITHER IMPLIED OR EXPRESS, INCLUDING, BUT NOT LIMITED
30             ## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
31             ## PARTICULAR PURPOSE, OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE
32             ## ANY PATENT, TRADEMARK OR OTHER RIGHTS.
33             ##
34             ##
35             ## Contact: graph-dev@caida.org
36             ##
37             ##
38              
39             $VERSION = 3.2;
40              
41             package Chart::Graph::Xmgrace::Dataset;
42 4     4   21 use Carp;
  4         7  
  4         1015  
43              
44             sub new {
45 11     11 0 15 my $that = shift;
46 11   33     37 my $class = ref($that) || $that;
47 11         46 my $self = {
48             "data" => undef, # holds a reference to data
49             "options" => undef,
50             "set_type" => undef, # holds set type ie, XY, BAR for the dataset
51             "set_number" => undef, # holds set number
52             "set_color" => undef, # holds the default set color number
53             "data_format" => undef,
54             };
55             # $self->{set_color} = $self->{set_number} + 1;
56 11         28 bless $self, $class;
57 11         28 return $self;
58             }
59              
60             sub AUTOLOAD {
61 88     88   107 my $self = shift;
62 88   33     1385 my $type = ref($self) || croak "$self is not an object";
63 88         105 my $name = $AUTOLOAD;
64 88         750 $name =~ s/.*://; #strip fully-qualified portion
65 88 50 33     390 unless ( ($name eq "DESTROY") or (exists $self->{$name})) {
66 0         0 croak "Can't access '$name' field in object of class $type";
67             }
68              
69 88 100       152 if (@_) {
70 66         181 return $self->{$name} = shift;
71             } else {
72 22         81 return $self->{$name};
73             }
74             }
75              
76             1;