2 use warnings FATAL => 'all';
6 use t::common qw( new_fh );
10 # testing the various modes of opening a file
12 my ($fh, $filename) = new_fh();
14 my $db = tie %hash, 'DBM::Deep', $filename;
16 ok(1, "Tied an hash with an array for params" );
20 my ($fh, $filename) = new_fh();
22 my $db = tie %hash, 'DBM::Deep', {
26 ok(1, "Tied a hash with a hashref for params" );
30 my ($fh, $filename) = new_fh();
32 my $db = tie @array, 'DBM::Deep', $filename;
34 ok(1, "Tied an array with an array for params" );
36 is( $db->{type}, DBM::Deep->TYPE_ARRAY, "TIE_ARRAY sets the correct type" );
40 my ($fh, $filename) = new_fh();
42 my $db = tie @array, 'DBM::Deep', {
46 ok(1, "Tied an array with a hashref for params" );
48 is( $db->{type}, DBM::Deep->TYPE_ARRAY, "TIE_ARRAY sets the correct type" );
51 my ($fh, $filename) = new_fh();
53 tie my %hash, 'DBM::Deep', [ file => $filename ];
54 } qr/Not a hashref/, "Passing an arrayref to TIEHASH fails";
57 tie my @array, 'DBM::Deep', [ file => $filename ];
58 } qr/Not a hashref/, "Passing an arrayref to TIEARRAY fails";
61 tie my %hash, 'DBM::Deep', undef, file => $filename;
62 } qr/Odd number of parameters/, "Odd number of params to TIEHASH fails";
65 tie my @array, 'DBM::Deep', undef, file => $filename;
66 } qr/Odd number of parameters/, "Odd number of params to TIEARRAY fails";