2 use warnings FATAL => 'all';
6 use t::common qw( new_dbm new_fh );
11 my $dbm_factory = new_dbm();
12 while ( my $dbm_maker = $dbm_factory->() ) {
14 my $db = $dbm_maker->();
17 $db->{scalarref} = \$x;
18 } qr/Storage of references of type 'SCALAR' is not supported/,
19 'Storage of scalar refs not supported';
22 $db->{scalarref} = \\$x;
23 } qr/Storage of references of type 'REF' is not supported/,
24 'Storage of ref refs not supported';
27 $db->{scalarref} = sub { 1 };
28 } qr/Storage of references of type 'CODE' is not supported/,
29 'Storage of code refs not supported';
32 my ($fh, $filename) = new_fh;
33 $db->{scalarref} = $fh;
34 } qr/Storage of references of type 'GLOB' is not supported/,
35 'Storage of glob refs not supported';
39 todo_skip "Refs to DBM::Deep objects aren't implemented yet", 2;
41 $db->{selfref} = \$db->{scalar};
42 } "Refs to DBM::Deep objects are ok";
44 is( ${$db->{selfref}}, $x, "A ref to a DBM::Deep object is ok" );
49 my $db = $dbm_maker->();
51 is( $db->{scalar}, $x, "Scalar retrieved ok" );
53 todo_skip "Refs to DBM::Deep objects aren't implemented yet", 2;
54 is( ${$db->{scalarref}}, 30, "Scalarref retrieved ok" );
55 is( ${$db->{selfref}}, 26, "Scalarref to stored scalar retrieved ok" );