summaryrefslogtreecommitdiff
path: root/cpan/IO-Compress/examples/compress-zlib/gzstream
blob: faacb0a0dd70ac874ae30b238f36212ffa8de744 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/local/bin/perl

use strict ;
use warnings ;

use Compress::Zlib ;

binmode STDOUT;	# gzopen only sets it on the fd

#my $gz = gzopen(\*STDOUT, "wb")
my $gz = gzopen('-', "wb")
	  or die "Cannot open stdout: $gzerrno\n" ;

while (<>) {
    $gz->gzwrite($_) 
	or die "error writing: $gzerrno\n" ;
}

$gz->gzclose ;