| 1 | package DWH_File::Registry; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 9 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 9 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 9 | ▶ | use vars qw( @ISA $VERSION ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 9 | @ISA = qw( ); | |||||||||||||||||||
| 8 | 9 | $VERSION = 0.01; | |||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 26 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||
| 11 | 26 | my ( $this, $kernel, $property ) = @_; | |||||||||||||||||||
| 12 | 26 | ▶ | 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
| |||||||||||||||||||||
| 13 | 26 | my $id = $kernel->fetch_property( $property . ':id' ); | |||||||||||||||||||
| 14 | 26 | ▶ | unless ( defined $id ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 15 | 8 | $id = $kernel->next_id; | |||||||||||||||||||
| 16 | 8 | $kernel->store_property( $property . ':id', $id ); | |||||||||||||||||||
| 17 | } | ||||||||||||||||||||
| 18 | 26 | my $self = { id => $id, | |||||||||||||||||||
| 19 | id_mill => DWH_File::ID_Mill->new( $kernel, | ||||||||||||||||||||
| 20 | $property . ':id_mill' ), | ||||||||||||||||||||
| 21 | kernel => $kernel, | ||||||||||||||||||||
| 22 | }; | ||||||||||||||||||||
| 23 | 26 | ▶ | $self->{ id_mill }{ current } ||= 0; | ||||||||||||||||||
|
Condition100%2/2
$self->{"id_mill"}{"current"} ||= 0
MC/DC100%1/1
$self->{"id_mill"}{"current"} ||= 0
$self->{"id_mill"}{"current"}
Truth table100%2/2
A
A= $self->{"id_mill"}{"current"}
| |||||||||||||||||||||
| 24 | 26 | bless $self, $class; | |||||||||||||||||||
| 25 | 26 | return $self; | |||||||||||||||||||
| 26 | } | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 26 | ▶ | sub save { | ||||||||||||||||||
|
Subroutine
save: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 29 | 26 | $_[ 0 ]->{ id_mill }->save; | |||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 68 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 33 | 68 | $_[ 0 ]->{ kernel }->fetch( pack "LaS", $_[ 0 ]->{ id }, '>', $_[ 1 ] ); | |||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 58 | ▶ | sub fetch_key_pack { | ||||||||||||||||||
|
Subroutine
fetch_key_pack: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 37 | 58 | $_[ 0 ]->{ kernel }->fetch( pack "Laa*", $_[ 0 ]->{ id }, '<', $_[ 1 ] ); | |||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 22 | ▶ | sub store { | ||||||||||||||||||
|
Subroutine
store: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 41 | 22 | my ( $self, $subscript, $value ) = @_; | |||||||||||||||||||
| 42 | 22 | my $id_p = pack "L", $self->{ id }; | |||||||||||||||||||
| 43 | 22 | $self->{ kernel }->store( "$id_p>$subscript", $value ); | |||||||||||||||||||
| 44 | 22 | $self->{ kernel }->store( "$id_p<$value", $subscript ); | |||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 58 | ▶ | sub get_key { | ||||||||||||||||||
|
Subroutine
get_key: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 48 | 58 | my ( $self, $value ) = @_; | |||||||||||||||||||
| 49 | 58 | my $key_p = $self->fetch_key_pack( $value ); | |||||||||||||||||||
| 50 | 58 | my $key; | |||||||||||||||||||
| 51 | 58 | ▶ | if ( defined $key_p ) { $key = unpack "S", $key_p } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 52 | else { | ||||||||||||||||||||
| 53 | 22 | $key = $self->{ id_mill }->next; | |||||||||||||||||||
| 54 | 22 | $key_p = pack "S", $key; | |||||||||||||||||||
| 55 | 22 | $self->store( $key_p, $value ); | |||||||||||||||||||
| 56 | } | ||||||||||||||||||||
| 57 | 58 | return $key; | |||||||||||||||||||
| 58 | } | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 9 | 1; | |||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | __END__ | ||||||||||||||||||||