5 use Test::More tests => 6;
7 use t::common qw( new_fh );
11 my ($fh, $filename) = new_fh();
12 my $db = DBM::Deep->new({
18 # Create structure in memory
23 array1 => [ "elem0", "elem1", "elem2" ],
25 subkey1 => "subvalue1",
26 subkey2 => "subvalue2",
27 subkey3 => bless( {}, 'Foo' ),
34 $db->import( $struct );
41 array1 => [ 'elem0', 'elem1', 'elem2', ],
43 subkey1 => "subvalue1",
44 subkey2 => "subvalue2",
45 subkey3 => useclass( bless {}, 'Foo' ),
51 $struct->{foo} = 'bar';
52 is( $struct->{foo}, 'bar', "\$struct has foo and it's 'bar'" );
53 ok( !exists $db->{foo}, "\$db doesn't have the 'foo' key, so \$struct is not tied" );
55 $struct->{hash1}->{foo} = 'bar';
56 is( $struct->{hash1}->{foo}, 'bar', "\$struct->{hash1} has foo and it's 'bar'" );
57 ok( !exists $db->{hash1}->{foo}, "\$db->{hash1} doesn't have the 'foo' key, so \$struct->{hash1} is not tied" );
61 Need to add tests for:
62 - Failure case (have something tied or a glob or something like that)
63 - Where we already have $db->{hash1} to make sure that it's not overwritten