Graph/Xmgrace/Dataset.pm

filter: Statementstmt 94.7% 18 / 19 Branchbran 75.0% 3 / 4 Conditioncond 50.0% 4 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 70.0% 28 / 40 CC 6 SCAR 13.7
CC
6
Cov
81%
AUTOLOAD
5.3
new
2.1
BEGIN
1.0
CRAP 3.9
« Graph/Xmgrace/Axis.pm ↑ Summary Graph/Xmgrace/Graph_Presentation_Type.pm »
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 4 $VERSION = 3.2;
40  
41 package Chart::Graph::Xmgrace::Dataset;
42 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 11 ▶sub new {
Subroutine new: called CC=2 SCAR=7.2
Pod undocumented
45 11 my $that = shift;
46 11 ▶ my $class = ref($that) || $that;
Condition33%1/3
ref $that || $that
l!l&&r!l&&!r
0110
MC/DC0%0/2
ref $that || $that
ref $that $that
Truth table33%1/3
A || B
A= ref $thatB= $that
ABresult
1X1
011
000
47 11 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 bless $self, $class;
57 11 return $self;
58 }
59  
60 99 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=5 SCAR=16.6
61 99 my $self = shift;
62 99 ▶ my $type = ref($self) || croak "$self is not an object";
Condition50%1/2
ref $self || croak("$self is not an object")
l!l
990
MC/DC0%0/1
ref $self || croak("$self is not an object")
ref $self
Truth table50%1/2
A
A= ref $self
Aresult
11
00
63 99 my $name = $AUTOLOAD;
64 99 $name =~ s/.*://; #strip fully-qualified portion
65 99 ▶ unless ( ($name eq "DESTROY") or (exists $self->{$name})) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($name eq "DESTROY" or exists $self->{$name}) 0 99 99
Condition66%2/3
$name eq "DESTROY" or exists $self->{$name}
l!l&&r!l&&!r
11880
MC/DC0%0/2
$name eq "DESTROY" or exists $self->{$name}
$name eq "DESTROY" exists $self->{$name}
Truth table66%2/3
A or B
A= $name eq "DESTROY"B= exists $self->{$name}
ABresult
1X1
011
000
66 0 croak "Can't access '$name' field in object of class $type";
67 }
68  
69 99 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 66 33 99
70 66 return $self->{$name} = shift;
71 } else {
72 33 return $self->{$name};
73 }
74 }
75  
76 4 1;
« Graph/Xmgrace/Axis.pm ↑ Summary Graph/Xmgrace/Graph_Presentation_Type.pm »