blib/lib/DBM/Deep/Sector/File/Null.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 3 totaltotal 92.1% 35 / 38 CC 2 SCAR 2.0
CC
2
Cov
100%
_init
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/DBM/Deep/Iterator.pm ↑ Summary blib/lib/DBM/Deep/Sector.pm »
1 package DBM::Deep::Sector::File::Null;
2  
3 47 ▶use 5.006_000;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 47 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 47 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 47 ▶use base qw( DBM::Deep::Sector::File::Data );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 47 my $STALE_SIZE = 2;
11  
12 # Please refer to the pack() documentation for further information
13 47 my %StP = (
14 1 => 'C', # Unsigned char value (no order needed as it's just one byte)
15 2 => 'n', # Unsigned short in "network" (big-endian) order
16 4 => 'N', # Unsigned long in "network" (big-endian) order
17 8 => 'Q', # Usigned quad (no order specified, presumably machine-dependent)
18 );
19  
20 117 ▶sub type { $_[0]{engine}->SIG_NULL }
Subroutine type: called CC=1 SCAR=0.0
Pod undocumented
21 117 ▶sub data_length { 0 }
Subroutine data_length: called CC=1 SCAR=0.0
Pod undocumented
22 79 ▶sub data { return }
Subroutine data: called CC=1 SCAR=0.0
Pod undocumented
23  
24 sub _init {
25 208 ▶ my $self = shift;
Subroutine _init: called CC=2 SCAR=6.9
26  
27 208 my $engine = $self->engine;
28  
29 208 ▶ unless ( $self->offset ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->offset) 117 91 208
30 117 my $leftover = $self->size - $self->base_size - 1 * $engine->byte_size - 1;
31  
32 117 $self->{offset} = $engine->_request_data_sector( $self->size );
33 117 $engine->storage->print_at( $self->offset, $self->type ); # Sector type
34 # Skip staleness counter
35 $engine->storage->print_at( $self->offset + $self->base_size,
36 pack( $StP{$engine->byte_size}, 0 ), # Chain loc
37 117 pack( $StP{1}, $self->data_length ), # Data length
38 chr(0) x $leftover, # Zero-fill the rest
39 );
40  
41 117 return;
42 }
43 }
44  
45 47 1;
46 __END__
« blib/lib/DBM/Deep/Iterator.pm ↑ Summary blib/lib/DBM/Deep/Sector.pm »