2 use warnings FATAL => 'all';
7 use t::common qw( new_dbm );
10 my $dbm_factory = new_dbm();
11 while ( my $dbm_maker = $dbm_factory->() ) {
12 my $db = $dbm_maker->();
21 isa_ok( tied(%hash), 'DBM::Deep::Hash' );
23 is( $db->{hash}{foo}, 1 );
24 cmp_deeply( $db->{hash}{bar}, noclass([ 1 .. 3 ]) );
25 cmp_deeply( $db->{hash}{baz}, noclass({ a => 42 }) );
28 is( $db->{hash}{foo}, 2 );
31 is( $db->{hash}{bar}[1], 90 );
34 is( $db->{hash}{baz}{b}, 33 );
37 1, [ 1 .. 3 ], { a => 42 },
40 $db->{array} = \@array;
41 isa_ok( tied(@array), 'DBM::Deep::Array' );
43 is( $db->{array}[0], 1 );
44 cmp_deeply( $db->{array}[1], noclass([ 1 .. 3 ]) );
45 cmp_deeply( $db->{array}[2], noclass({ a => 42 }) );
48 is( $db->{array}[0], 2 );
51 is( $db->{array}[1][2], 9 );
53 $array[2]{b} = 'floober';
54 is( $db->{array}[2]{b}, 'floober' );
56 my %hash2 = ( abc => [ 1 .. 3 ] );
59 $hash2{ def } = \%hash;
60 is( $array[3]{def}{foo}, 2 );