seek($fh, $self->{data_size} + $self->{index_size}, SEEK_CUR);
my $size;
- read( $fh, $size, $self->{data_size}); $size = unpack($self->{data_pack}, $size);
+ read( $fh, $size, $self->{data_size});
+ $size = unpack($self->{data_pack}, $size);
if ($size) { seek($fh, $size, SEEK_CUR); }
my $bless_bit;
# Yes, object needs to be re-blessed
##
my $class_name;
- read( $fh, $size, $self->{data_size}); $size = unpack($self->{data_pack}, $size);
+ read( $fh, $size, $self->{data_size});
+ $size = unpack($self->{data_pack}, $size);
if ($size) { read( $fh, $class_name, $size); }
if ($class_name) { $new_obj = bless( $new_obj, $class_name ); }
}
# DBM::Deep Test
##
use strict;
-use Test::More tests => 6;
+use Test::More tests => 15;
use Test::Exception;
use File::Temp qw( tempfile tempdir );
use Fcntl qw( :flock );
$hash{foo} = 2;
is( $db->{hash}{foo}, 2 );
+
+$hash{bar}[1] = 90;
+is( $db->{hash}{bar}[1], 90 );
+
+$hash{baz}{b} = 33;
+is( $db->{hash}{baz}{b}, 33 );
+
+my @array = (
+ 1, [ 1 .. 3 ], { a => 42 },
+);
+
+$db->{array} = \@array;
+isa_ok( tied(@array), 'DBM::Deep::Array' );
+
+is( $db->{array}[0], 1 );
+is_deeply( $db->{array}[1], [ 1 .. 3 ] );
+is_deeply( $db->{array}[2], { a => 42 } );
+
+$array[0] = 2;
+is( $db->{array}[0], 2 );
+
+$array[1][2] = 9;
+is( $db->{array}[1][2], 9 );
+
+$array[2]{b} = 'floober';
+is( $db->{array}[2]{b}, 'floober' );