| 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
MC/DC0%0/2
ref $this || $this
ref $this
$this
Truth table33%1/3
A || B
A= ref $thisB= $this
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 29 | 513 | ▶ | my $sl = $succ_len > 0 ? $succ_len : 0; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 33 | from_stored( $kernel, $pred_string ); | ||||||||||||||||||||
| 34 | 513 | ▶ | $succ_len > 0 and $self->{ succ } = DWH_File::Value::Factory-> | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 46 | 563 | ▶ | $sl = defined $succ ? length( "$succ" ) : -1; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 47 | 563 | ▶ | unless ( defined $pred ) { $pred = '' } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 48 | 563 | ▶ | unless ( defined $succ ) { $succ = '' } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||