2 use warnings FATAL => 'all';
6 use t::common qw( new_fh );
11 my ($fh, $filename) = new_fh();
12 print $fh "Not a DBM::Deep file";
14 my $old_fh = select $fh;
15 my $old_af = $|; $| = 1; $| = $old_af;
19 my $db = DBM::Deep->new( $filename );
20 } qr/^DBM::Deep: Signature not found -- file is not a Deep DB/, "Only DBM::Deep DB files will be opened";
23 my ($fh, $filename) = new_fh();
24 my $db = DBM::Deep->new( $filename );
26 $db->{key1} = "value1";
27 is( $db->{key1}, "value1", "Value set correctly" );
29 # Testing to verify that the close() will occur if open is called on an open DB.
30 #XXX WOW is this hacky ...
31 $db->_get_self->_engine->storage->open;
32 is( $db->{key1}, "value1", "Value still set after re-open" );
35 my $db = DBM::Deep->new( 't' );
36 } qr/^DBM::Deep: Cannot sysopen file 't': /, "Can't open a file we aren't allowed to touch";
39 my $db = DBM::Deep->new(
43 $db->_get_self->_engine->storage->close( $db->_get_self );
44 ok( !$db->lock, "Calling lock() on a closed database returns false" );
48 my $db = DBM::Deep->new(
53 $db->_get_self->_engine->storage->close( $db->_get_self );
54 ok( !$db->unlock, "Calling unlock() on a closed database returns false" );