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') };
20 BEGIN { use_ok('SDBM_File') };
21 BEGIN { use_ok('Fcntl') };
22 BEGIN { use_ok('Compress::Zlib') };
25 END { unlink <Op_dbmx*>; }
28 my $db1 = tie(%h1, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
30 ok $db1, "tied to SDBM_File";
32 # store before adding the filter
57 eval { $db1->Filter_Push('compress') };
58 is $@, '', "push a 'compress' filter" ;
61 no warnings 'uninitialized';
69 "\x00\x01" => "\x03\xFF",
76 use warnings FATAL => 'untie';
78 is $@, '', "untie without inner references" ;
81 # read the dbm file without the filter
83 my $db2 = tie(%h2, 'SDBM_File','Op_dbmx', O_RDWR|O_CREAT, 0640) ;
85 ok $db2, "tied to SDBM_File";
97 compress("") => compress(""),
98 compress("400") => compress("500"),
99 compress("0") => compress("1"),
100 compress("1") => compress("0"),
101 compress("abc") => compress("de0"),
102 compress("\x00\x01") => compress("\x03\xFF"),
107 use warnings FATAL => 'untie';
109 is $@, '', "untie without inner references" ;