3 use Test::More tests => 10;
5 use File::Temp qw( tempfile tempdir );
9 my $dir = tempdir( CLEANUP => 1 );
10 my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
14 my $db = DBM::Deep->new( $filename );
17 $db->{scalarref} = \$x;
18 } qr/Storage of variables of type 'SCALAR' is not supported/,
19 'Storage of scalar refs not supported';
22 $db->{scalarref} = \\$x;
23 } qr/Storage of variables of type 'REF' is not supported/,
24 'Storage of ref refs not supported';
27 $db->{scalarref} = sub { 1 };
28 } qr/Storage of variables of type 'CODE' is not supported/,
29 'Storage of code refs not supported';
32 $db->{scalarref} = $db->_get_self->_fh;
33 } qr/Storage of variables of type 'GLOB' is not supported/,
34 'Storage of glob refs not supported';
38 todo_skip "Refs to DBM::Deep objects aren't implemented yet", 2;
40 $db->{selfref} = \$db->{scalar};
41 } "Refs to DBM::Deep objects are ok";
43 is( ${$db->{selfref}}, $x, "A ref to a DBM::Deep object is ok" );
48 my $db = DBM::Deep->new( $filename );
50 is( $db->{scalar}, $x, "Scalar retrieved ok" );
52 todo_skip "Refs to DBM::Deep objects aren't implemented yet", 2;
53 is( ${$db->{scalarref}}, 30, "Scalarref retrieved ok" );
54 is( ${$db->{selfref}}, 26, "Scalarref to stored scalar retrieved ok" );