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..10\n"; 17 18$text = "abcd"; 19 20ok(1, $file = IO::Zlib->new($name, "wb")); 21ok(2, $file->print($text)); 22ok(3, $file->close()); 23 24ok(4, $file = IO::Zlib->new($name, "rb")); 25ok(5, $file->getc() eq substr($text,0,1)); 26ok(6, $file->getc() eq substr($text,1,1)); 27ok(7, $file->getc() eq substr($text,2,1)); 28ok(8, $file->getc() eq substr($text,3,1)); 29ok(9, $file->getc() eq ""); 30ok(10, $file->close()); 31 32unlink($name); 33