5 use Test::More tests => 6;
7 use t::common qw( new_fh );
11 my ($fh2, $filename2) = new_fh();
12 my $db2 = DBM::Deep->new( $filename2 );
15 my ($fh, $filename) = new_fh();
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" );
30 # Cross-ref nested hash accross DB objects
33 $db2->{copy} = $db->{hash1};
34 } qr/Cannot cross-reference\. Use export\(\) instead/, "cross-ref fails";
35 $db2->{copy} = $db->{hash1}->export;
39 # Make sure $db2 has copy of $db's hash structure
41 is( $db2->{copy}{subkey1}, 'subvalue1', "Value copied correctly" );
42 is( $db2->{copy}{subkey2}, 'subvalue2', "Value copied correctly" );