6 require "dbm_filter_util.pl";
8 use Test::More tests => 26;
10 BEGIN { use_ok('DBM_Filter') };
11 BEGIN { use_ok('SDBM_File') };
12 BEGIN { use_ok('Fcntl') };
15 END { unlink <Op_dbmx*>; }
18 my $db1 = tie(%h1, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
20 ok $db1, "tied to SDBM_File";
22 # store before adding the filter
35 eval { $db1->Filter_Push('null') };
36 is $@, '', "push a 'null' filter" ;
39 no warnings 'uninitialized';
49 "abc" => "", # not "def", because the filter is in place
54 while (my ($k, $v) = each %h1) {
55 no warnings 'uninitialized';
56 #diag "After Match [$k][$v]";
62 use warnings FATAL => 'untie';
64 is $@, '', "untie without inner references" ;
67 # read the dbm file without the filter, check for null termination
69 my $db2 = tie(%h2, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
71 ok $db2, "tied to SDBM_File";
76 "alpha\x00" => "beta\x00",
82 use warnings FATAL => 'untie';
84 is $@, '', "untie without inner references" ;