1use IO::Zlib; 2 3sub ok 4{ 5 my ($no, $ok) = @_ ; 6 7 #++ $total ; 8 #++ $totalBad unless $ok ; 9 10 print "ok $no\n" if $ok ; 11 print "not ok $no\n" unless $ok ; 12} 13 14$name="test.gz"; 15 16print "1..11\n"; 17 18$hello = <<EOM ; 19hello world 20this is a test 21EOM 22 23ok(1, tie *OUT, "IO::Zlib", $name, "wb"); 24ok(2, printf OUT "%s - %d\n", "hello", 123); 25ok(3, print OUT $hello); 26ok(4, untie *OUT); 27 28ok(5, tie *IN, "IO::Zlib", $name, "rb"); 29ok(6, !eof IN); 30ok(7, <IN> eq "hello - 123\n"); 31ok(8, read(IN, $uncomp, 1024) == length($hello)); 32ok(9, eof IN); 33ok(10, untie *IN); 34 35unlink($name); 36 37ok(11, $hello eq $uncomp); 38