3 use Test::More tests => 10;
5 use File::Temp qw( tempfile tempdir );
6 use Fcntl qw( :flock );
10 my $dir = tempdir( CLEANUP => 1 );
11 my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
16 my $db = DBM::Deep->new( $filename );
19 $db->{scalarref} = \$x;
20 } qr/Storage of variables of type 'SCALAR' is not supported/,
21 'Storage of scalar refs not supported';
24 $db->{scalarref} = \\$x;
25 } qr/Storage of variables of type 'REF' is not supported/,
26 'Storage of ref refs not supported';
29 $db->{scalarref} = sub { 1 };
30 } qr/Storage of variables of type 'CODE' is not supported/,
31 'Storage of code refs not supported';
34 $db->{scalarref} = $db->_get_self->_fh;
35 } qr/Storage of variables of type 'GLOB' is not supported/,
36 'Storage of glob refs not supported';
40 todo_skip "Refs to DBM::Deep objects aren't implemented yet", 2;
42 $db->{selfref} = \$db->{scalar};
43 } "Refs to DBM::Deep objects are ok";
45 is( ${$db->{selfref}}, $x, "A ref to a DBM::Deep object is ok" );
50 my $db = DBM::Deep->new( $filename );
52 is( $db->{scalar}, $x, "Scalar retrieved ok" );
54 todo_skip "Refs to DBM::Deep objects aren't implemented yet", 2;
55 is( ${$db->{scalarref}}, 30, "Scalarref retrieved ok" );
56 is( ${$db->{selfref}}, 26, "Scalarref to stored scalar retrieved ok" );