5 use Test::More tests => 5;
6 use File::Temp qw( tempfile tempdir );
10 my $dir = tempdir( CLEANUP => 1 );
11 my ($fh2, $filename2) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
12 my $db2 = DBM::Deep->new( $filename2 );
15 my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
16 my $db = DBM::Deep->new( $filename );
19 # Create structure in $db
23 subkey1 => "subvalue1",
24 subkey2 => "subvalue2",
27 is( $db->{hash1}{subkey1}, 'subvalue1', "Value imported correctly" );
28 is( $db->{hash1}{subkey2}, 'subvalue2', "Value imported correctly" );
31 # Cross-ref nested hash accross DB objects
33 $db2->{copy} = $db->{hash1};
37 # Make sure $db2 has copy of $db's hash structure
39 is( $db2->{copy}{subkey1}, 'subvalue1', "Value copied correctly" );
40 is( $db2->{copy}{subkey2}, 'subvalue2', "Value copied correctly" );