5 use Test::More tests => 5;
6 use File::Temp qw( tempfile tempdir );
7 use Fcntl qw( :flock );
11 my $dir = tempdir( CLEANUP => 1 );
12 my ($fh2, $filename2) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
14 my $db2 = DBM::Deep->new( $filename2 );
17 my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
19 my $db = DBM::Deep->new( $filename );
22 # Create structure in $db
26 subkey1 => "subvalue1",
27 subkey2 => "subvalue2",
30 is( $db->{hash1}{subkey1}, 'subvalue1', "Value imported correctly" );
31 is( $db->{hash1}{subkey2}, 'subvalue2', "Value imported correctly" );
34 # Cross-ref nested hash accross DB objects
36 $db2->{copy} = $db->{hash1};
40 # Make sure $db2 has copy of $db's hash structure
42 is( $db2->{copy}{subkey1}, 'subvalue1', "Value copied correctly" );
43 is( $db2->{copy}{subkey2}, 'subvalue2', "Value copied correctly" );