1use strict; 2use warnings; 3 4use IO::Zlib; 5 6sub ok 7{ 8 my ($no, $ok) = @_ ; 9 print "ok $no\n" if $ok ; 10 print "not ok $no\n" unless $ok ; 11} 12 13print "1..10\n"; 14 15my $hello = <<EOM ; 16hello world 17this is a test 18EOM 19 20my $name = "test_uncomp1_$$"; 21 22if (open(FH, ">$name")) 23{ 24 binmode FH; 25 print FH $hello; 26 close FH; 27} 28else 29{ 30 die "$name: $!"; 31} 32 33my $file; 34my $uncomp; 35 36ok(1, $file = IO::Zlib->new()); 37ok(2, $file->open($name, "rb")); 38ok(3, !$file->eof()); 39ok(4, $file->read($uncomp, 1024) == length($hello)); 40ok(5, $file->eof()); 41ok(6, $file->opened()); 42ok(7, $file->close()); 43ok(8, !$file->opened()); 44 45unlink($name); 46 47ok(9, $hello eq $uncomp); 48 49ok(10, !defined(IO::Zlib->new($name, "rb"))); 50