use strict;
use warnings FATAL => 'all';
-our $VERSION = q(1.0013);
+our $VERSION = q(1.0014);
use Data::Dumper ();
use Fcntl qw( :flock );
package DBM::Deep::Engine::Sector;
-use 5.006;
+use 5.006_000;
use strict;
use warnings FATAL => 'all';
#TODO: Convert this to a string
package DBM::Deep::Engine::Sector::BucketList;
-use 5.006;
+use 5.006_000;
use strict;
use warnings FATAL => 'all';
package DBM::Deep::Engine::Sector::Data;
-use 5.006;
+use 5.006_000;
use strict;
use warnings FATAL => 'all';
#TODO: Convert this to a string
package DBM::Deep::Engine::Sector::Index;
-use 5.006;
+use 5.006_000;
use strict;
use warnings FATAL => 'all';
package DBM::Deep::Engine::Sector::Null;
-use 5.006;
+use 5.006_000;
use strict;
use warnings FATAL => 'all';
#TODO: Convert this to a string
package DBM::Deep::Engine::Sector::Reference;
-use 5.006;
+use 5.006_000;
use strict;
use warnings FATAL => 'all';
my $e = $self->engine;
unless ( $self->offset ) {
- my $classname = Scalar::Util::blessed( delete $self->{data} );
- my $leftover = $self->size - $self->base_size - 3 * $e->byte_size;
+ $self->{staleness} = 0;
+ $self->{offset} = $e->_request_data_sector( $self->size );
my $class_offset = 0;
+ my $classname = Scalar::Util::blessed( delete $self->{data} );
if ( defined $classname ) {
my $class_sector = DBM::Deep::Engine::Sector::Scalar->new({
engine => $e,
$class_offset = $class_sector->offset;
}
- $self->{offset} = $e->_request_data_sector( $self->size );
- $e->storage->print_at( $self->offset, $self->type ); # Sector type
- # Skip staleness counter
- $e->storage->print_at( $self->offset + $self->base_size,
- pack( $e->StP($e->byte_size), 0 ), # Index/BList loc
- pack( $e->StP($e->byte_size), $class_offset ), # Classname loc
- pack( $e->StP($e->byte_size), 1 ), # Initial refcount
- chr(0) x $leftover, # Zero-fill the rest
+ my $string = chr(0) x $self->size;
+ substr( $string, 0, 1, $self->type );
+ substr( $string, $self->base_size, 3 * $e->byte_size,
+ pack( $e->StP($e->byte_size), 0 ) # Index/BList loc
+ . pack( $e->StP($e->byte_size), $class_offset ) # Classname loc
+ . pack( $e->StP($e->byte_size), 1 ) # Initial refcount
);
+ $e->storage->print_at( $self->offset, $string );
}
else {
$self->{type} = $e->storage->read_at( $self->offset, 1 );
- }
- $self->{staleness} = unpack(
- $e->StP($DBM::Deep::Engine::STALE_SIZE),
- $e->storage->read_at( $self->offset + $e->SIG_SIZE, $DBM::Deep::Engine::STALE_SIZE ),
- );
+ $self->{staleness} = unpack(
+ $e->StP($DBM::Deep::Engine::STALE_SIZE),
+ $e->storage->read_at( $self->offset + $e->SIG_SIZE, $DBM::Deep::Engine::STALE_SIZE ),
+ );
+ }
return;
}
#TODO: Convert this to a string
package DBM::Deep::Engine::Sector::Scalar;
-use 5.006;
+use 5.006_000;
use strict;
use warnings FATAL => 'all';
-our $VERSION = '0.01';
-
use DBM::Deep::Engine::Sector::Data;
our @ISA = qw( DBM::Deep::Engine::Sector::Data );
package DBM::Deep::Iterator;
-use 5.006;
+use 5.006_000;
use strict;
use warnings FATAL => 'all';
package DBM::Deep::Iterator::BucketList;
-use 5.006;
+use 5.006_000;
use strict;
use warnings FATAL => 'all';
package DBM::Deep::Iterator::Index;
-use 5.006;
+use 5.006_000;
use strict;
use warnings FATAL => 'all';
# I need an undef value, not an implementation of the Null Class pattern.
package DBM::Deep::Null;
-use 5.006;
+use 5.006_000;
use strict;
use warnings FATAL => 'all';
}
}
-plan tests => 292;
+plan tests => 302;
use t::common qw( new_fh );
use File::Spec;
'0.981', '0.982', '0.983',
'0.99_01', '0.99_02', '0.99_03', '0.99_04',
'1.00', '1.000', '1.0000', '1.0001', '1.0002',
- '1.0003', '1.0004', '1.0005', '1.0006', '1.0007', '1.0008', '1.0009', '1.0010', '1.0011', '1.0012', '1.0013',
+ '1.0003', '1.0004', '1.0005', '1.0006', '1.0007', '1.0008', '1.0009', '1.0010',
+ '1.0011', '1.0012', '1.0013', '1.0014',
);
foreach my $input_filename (
"-version $v",
);
+ #warn "Testing $input_filename against $v\n";
+
# Clone was removed as a requirement in 1.0006
if ( $output =~ /Can\'t locate Clone\.pm in \@INC/ ) {
ok( 1 );
die "$output\n" if $output;
my $db;
- if ( $v =~ /^1\.001[0-3]/ || $v =~ /^1\.000[3-9]/ ) {
+ if ( $v =~ /^1\.001[0-4]/ || $v =~ /^1\.000[3-9]/ ) {
push @INC, 'lib';
eval "use DBM::Deep";
$db = DBM::Deep->new( $output_filename );
my %opts = (
man => 0,
help => 0,
- version => '1.0013',
+ version => '1.0014',
autobless => 1,
);
GetOptions( \%opts,
{
my $ver = $opts{version};
- if ( $ver =~ /^1\.001[0-3]/) {
- $ver = 3;
- }
- elsif ( $ver =~ /^1\.000[3-9]/) {
+ if ( $ver =~ /^1\.001[0-4]/ || $ver =~ /^1\.000[3-9]/) {
$ver = 3;
}
elsif ( $ver =~ /^1\.000?[0-2]?/) {