PerlIO-via-gzip

 view release on metacpan or  search on metacpan

t/001_roundtrip.t  view on Meta::CPAN

ok open( $tmph, ">:via(gzip)", $tmpf), "open tempfile for compressed writing";
my ($first,$last) = (rand(), rand());
print $tmph $first,"\n";
for (0..1000) {
    print $tmph rand(),"\n";
}
print $tmph $last, "\n";
ok $tmph->close, "flush and put the lid down";
my $data;
gunzip $tmpf => \$data;
is( (split m{$/},$data)[0], $first, "first entry roundtrip" );
is( (split m{$/},$data)[-1], $last, "last entry roundtrip");
my $works = "It works!";
gzip \$works => $tmpf;
undef $tmph;
ok open($tmph, "<:via(gzip)", $tmpf), "open tempfile for decompressed reading";
is( my $a = <$tmph>, "It works!", "reading roundtrip" );

1;





( run in 0.325 second using v1.01-cache-2.11-cpan-e93a5daba3e )