5 use Test::More tests => 7;
7 use File::Temp qw( tempfile tempdir );
8 use Fcntl qw( :flock );
10 use_ok( 'DBM::Deep' );
13 my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
18 tie %hash, 'DBM::Deep', $filename;
20 $hash{key1} = 'value';
21 is( $hash{key1}, 'value', 'Set and retrieved key1' );
26 tie %hash, 'DBM::Deep', $filename;
28 is( $hash{key1}, 'value', 'Set and retrieved key1' );
30 is( keys %hash, 1, "There's one key so far" );
31 ok( exists $hash{key1}, "... and it's key1" );
36 tie my @array, 'DBM::Deep', {
38 type => DBM::Deep->TYPE_ARRAY,
40 } qr/DBM::Deep: File type mismatch/, "\$SIG_TYPE doesn't match file's type";
44 my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
46 DBM::Deep->new( file => $filename, type => DBM::Deep->TYPE_ARRAY );
49 tie my %hash, 'DBM::Deep', {
51 type => DBM::Deep->TYPE_HASH,
53 } qr/DBM::Deep: File type mismatch/, "\$SIG_TYPE doesn't match file's type";