NASA_Ames/DataEntry.pm

filter: Statementstmt 90.3% 28 / 31 Branchbran 66.6% 4 / 6 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 74.5% 41 / 55 CC 7 SCAR 16.9
CC
7
Cov
79%
new
9.1
_carp
2.0
BEGIN
1.0
CRAP 5.4
« NASA_Ames/FFI2310.pm ↑ Summary NASA_Ames/FFI1010.pm »
1 package Pure::Text::NASA_Ames::DataEntry;
2 10 ▶use base qw(Class::Accessor);
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 10 Pure::Text::NASA_Ames::DataEntry->mk_accessors(qw(A X V));
5  
6 package Text::NASA_Ames::DataEntry;
7 10 ▶use base qw(Pure::Text::NASA_Ames::DataEntry);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 10 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 10 ▶use 5.00600;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 0 ▶sub _carp {
Subroutine _carp: not called CC=1 SCAR=6.9
14 0 return Carp::carp(@_);
15 }
16  
17  
18 10 our $VERSION = do { my @r = (q$Revision: 1.1 $ =~ /\d+/g); sprintf " %d." . "%02d" x $#r, @r };
19  
20  
21 =head1 NAME
22  
23 Text::NASA_Ames::DataEntry - The simples NASA_Ames data-presentation
24  
25 =head1 SYNOPSIS
26  
27 my $de = new Text::NASA_Ames::DataEntry({X => [1,2,3],
28 V => [3.3,3],
29 A => [1.4, "S"]});
30 my @x = @{ $de->X };
31 my @a = @{ $de->A };
32 my @v = @{ $de->V };
33  
34 =head1 DESCRIPTION
35  
36 A dataentry consists of the independent variables X, the auxiliary
37 variables A, and the primary dependent variables V.
38  
39 =head1 PUBLIC METHODS
40  
41 all methods return list-references
42  
43 =over 4
44  
45 =item new ({X => [X1...Xs], A => [A1...Ak], V => [V1..Vn]})
46  
47 set the data
48  
49 =cut
50  
51 809 ▶sub new {
Subroutine new: called CC=7 SCAR=22.0
Pod documented
52 809 my ($class, $dataRef) = @_;
53 809 ▶ $class = ref $class || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
08090
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
54 809 my $self = { X => [],
55 A => [],
56 V => [] };
57 809 ▶ if (ref $dataRef && (ref $dataRef eq 'HASH')) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $dataRef and ref $dataRef eq 'HASH') { } 809 0 809
Condition33%1/3
ref $dataRef and ref $dataRef eq "HASH"
!ll&&!rl&&r
00809
MC/DC0%0/2
ref $dataRef and ref $dataRef eq "HASH"
ref $dataRef ref $dataRef eq "HASH"
Truth table33%1/3
A and B
A= ref $dataRefB= ref $dataRef eq "HASH"
ABresult
0X0
100
111
58 809 foreach my $item (keys %$self) {
59 2427 ▶ if (exists $dataRef->{$item}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $dataRef->{$item}) 2373 54 2427
60 2373 ▶ if (ref $dataRef->{$item} eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $dataRef->{$item} eq 'ARRAY') { } 2373 0 2373
61 2373 $self->{$item} = $dataRef->{$item};
62 } else {
63 _carp "$item not a ArrayRef, got item:".
64 0 $dataRef->{$item};
65 }
66 }
67 }
68 } else {
69 0 _carp "new need a hash as argument, got $dataRef";
70 }
71 809 return bless $self, $class;
72 }
73
74  
75 =item X
76  
77 get a list of the independent variable per point
78  
79 =item V
80  
81 get a list of the primary dependent variables for point X
82  
83 =item A
84  
85 get a list of the auxiliary variables for point X
86  
87 =back
88  
89 =cut
90  
91  
92  
93  
94 10 1;
95 __END__
« NASA_Ames/FFI2310.pm ↑ Summary NASA_Ames/FFI1010.pm »