This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix execute permissions on the last commit
[perl5.git] / cpan / Compress-Raw-Zlib / examples / filtinf
CommitLineData
25f0751f
PM
1#!/usr/local/bin/perl
2
3use Compress::Raw::Zlib ;
4
5use strict ;
6use warnings ;
7
8binmode STDIN;
9binmode STDOUT;
10
11my $x = new Compress::Raw::Zlib::Inflate
12 or die "Cannot create a inflation stream\n" ;
13
14my $input = '' ;
15my $output = '' ;
16my $status ;
17
18while (read(STDIN, $input, 4096))
19{
20 $status = $x->inflate($input, $output) ;
21
22 print $output
23 if $status == Z_OK or $status == Z_STREAM_END ;
24
25 last if $status != Z_OK ;
26}
27
28die "inflation failed\n"
29 unless $status == Z_STREAM_END ;
30