8 eval { require Compress::Zlib ; };
10 print "1..0 # Skip: Compress::Zlib is not available\n";
15 require "dbm_filter_util.pl";
17 use Test::More tests => 23;
19 BEGIN { use_ok('DBM_Filter') };
23 foreach (qw/SDBM_File ODBM_File NDBM_File GDBM_File DB_File/) {
24 if ($Config{extensions} =~ /\b$_\b/) {
31 BEGIN { use_ok('Fcntl') };
32 BEGIN { use_ok('Compress::Zlib') };
35 END { unlink <Op_dbmx*>; }
38 my $db1 = tie(%h1, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
40 ok $db1, "tied to $db_file";
42 # store before adding the filter
67 eval { $db1->Filter_Push('compress') };
68 is $@, '', "push a 'compress' filter" ;
71 no warnings 'uninitialized';
79 "\x00\x01" => "\x03\xFF",
86 use warnings FATAL => 'untie';
88 is $@, '', "untie without inner references" ;
91 # read the dbm file without the filter
93 my $db2 = tie(%h2, $db_file,'Op_dbmx', O_RDWR|O_CREAT, 0640) ;
95 ok $db2, "tied to $db_file";
107 compress("") => compress(""),
108 compress("400") => compress("500"),
109 compress("0") => compress("1"),
110 compress("1") => compress("0"),
111 compress("abc") => compress("de0"),
112 compress("\x00\x01") => compress("\x03\xFF"),
117 use warnings FATAL => 'untie';
119 is $@, '', "untie without inner references" ;