6 require "dbm_filter_util.pl";
10 BEGIN { use_ok('DBM_Filter') };
14 foreach (qw/SDBM_File ODBM_File NDBM_File GDBM_File DB_File/) {
15 if ($Config{extensions} =~ /\b$_\b/) {
22 BEGIN { use_ok('Fcntl') };
25 END { unlink <Op_dbmx*>; }
28 my $db1 = tie(%h1, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
30 ok $db1, "tied to $db_file";
32 # store before adding the filter
45 eval { $db1->Filter_Push('null') };
46 is $@, '', "push a 'null' filter" ;
49 no warnings 'uninitialized';
59 "abc" => "", # not "def", because the filter is in place
64 while (my ($k, $v) = each %h1) {
65 no warnings 'uninitialized';
66 #diag "After Match [$k][$v]";
72 use warnings FATAL => 'untie';
74 is $@, '', "untie without inner references" ;
77 # read the dbm file without the filter, check for null termination
79 my $db2 = tie(%h2, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
81 ok $db2, "tied to $db_file";
86 "alpha\x00" => "beta\x00",
92 use warnings FATAL => 'untie';
94 is $@, '', "untie without inner references" ;