DWH_File/Tie/Hash/Node.pm

filter: Statementstmt 100% 44 / 44 Branchbran 100% 16 / 16 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 5 totaltotal 88.6% 70 / 79 CC 10 SCAR 12.1
CC
10
Cov
97%
from_stored
5.0
to_string
5.0
new
2.1
CRAP 3.3
« DWH_File/Kernel.pm ↑ Summary DWH_File/Tie/Scalar.pm »
1 package DWH_File::Tie::Hash::Node;
2  
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use vars qw( @ISA $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
5 use overload
6 9 ▶ '""' => \&to_string,
Subroutine BEGIN: called CC=1 SCAR=0.0
7 9 fallback => 1;
8  
9 9 ▶use DWH_File::Slot;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 9 @ISA = qw( DWH_File::Slot );
12 9 $VERSION = 0.01;
13  
14 563 ▶sub new {
Subroutine new: called CC=2 SCAR=7.2
Pod undocumented
15 563 my ( $this ) = @_;
16 563 ▶ my $class = ref( $this ) || $this;
Condition33%1/3
ref $this || $this
l!l&&r!l&&!r
05630
MC/DC0%0/2
ref $this || $this
ref $this $this
Truth table33%1/3
A || B
A= ref $thisB= $this
ABresult
1X1
011
000
17 563 my $self = { pred => undef,
18 succ => undef,
19 };
20 563 bless $self, $class;
21 563 return $self;
22 }
23  
24 513 ▶sub from_stored {
Subroutine from_stored: called CC=5 SCAR=16.1
Pod undocumented
25 513 my ( $this, $kernel, $data, $subscript ) = @_;
26 513 my $self = $this->new;
27 513 my ( $pred_len, $succ_len ) = unpack "ll", $data;
28 513 ▶ my $pl = $pred_len > 0 ? $pred_len : 0;
Branch: 1 branch
BranchTrueFalseTotal
$pred_len > 0 ? : 363 150 513
29 513 ▶ my $sl = $succ_len > 0 ? $succ_len : 0;
Branch: 1 branch
BranchTrueFalseTotal
$succ_len > 0 ? : 421 92 513
30 513 my ( $ignore, $pred_string, $succ_string, $value_string ) =
31 unpack "a8 a$pl a$sl a*", $data;
32 513 ▶ $pred_len > 0 and $self->{ pred } = DWH_File::Value::Factory->
Branch: 1 branch
BranchTrueFalseTotal
$pred_len > 0 and $self->{"pred"} = "DWH_File::Value::Factory"->from_stored($kernel, $pred_string) 363 150 513
33 from_stored( $kernel, $pred_string );
34 513 ▶ $succ_len > 0 and $self->{ succ } = DWH_File::Value::Factory->
Branch: 1 branch
BranchTrueFalseTotal
$succ_len > 0 and $self->{"succ"} = "DWH_File::Value::Factory"->from_stored($kernel, $succ_string) 421 92 513
35 from_stored( $kernel, $succ_string );
36 513 $self->{ value } = DWH_File::Value::Factory->from_stored( $kernel,
37 $value_string );
38 513 $self->{ subscript } = $subscript;
39 513 return $self;
40 }
41  
42 563 ▶sub to_string {
Subroutine to_string: called CC=5 SCAR=16.1
Pod undocumented
43 563 my ( $pred, $succ ) = @{ $_[ 0 ] }{ qw( pred succ) };
44 563 my ( $pl, $sl );
45 563 ▶ $pl = defined $pred ? length( "$pred" ) : -1;
Branch: 1 branch
BranchTrueFalseTotal
defined $pred ? : 401 162 563
46 563 ▶ $sl = defined $succ ? length( "$succ" ) : -1;
Branch: 1 branch
BranchTrueFalseTotal
defined $succ ? : 460 103 563
47 563 ▶ unless ( defined $pred ) { $pred = '' }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pred) 162 401 563
48 563 ▶ unless ( defined $succ ) { $succ = '' }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $succ) 103 460 563
49 563 my $res = pack( "ll", $pl, $sl ) . "$pred$succ$_[ 0 ]->{ value }";
50 563 return $res;
51 }
52  
53 50 ▶sub set_successor { $_[ 0 ]->{ succ } = $_[ 1 ] }
Subroutine set_successor: called CC=1 SCAR=0.0
Pod undocumented
54  
55 37 ▶sub set_predecessor { $_[ 0 ]->{ pred } = $_[ 1 ] }
Subroutine set_predecessor: called CC=1 SCAR=0.0
Pod undocumented
56  
57 9 1;
58  
59 __END__
« DWH_File/Kernel.pm ↑ Summary DWH_File/Tie/Scalar.pm »