Commit | Line | Data |
---|---|---|
f4c6fd49 | 1 | #!/usr/local/bin/perl |
2 | ||
642e522c | 3 | use Compress::Zlib 2 ; |
4 | ||
f4c6fd49 | 5 | use strict ; |
8aa25532 | 6 | use warnings ; |
f4c6fd49 | 7 | |
642e522c | 8 | binmode STDIN; |
9 | binmode STDOUT; | |
f4c6fd49 | 10 | |
642e522c | 11 | my $x = new Compress::Zlib::Inflate |
f4c6fd49 | 12 | or die "Cannot create a inflation stream\n" ; |
13 | ||
14 | my $input = '' ; | |
642e522c | 15 | my $output = '' ; |
16 | my $status ; | |
f4c6fd49 | 17 | |
f4c6fd49 | 18 | while (read(STDIN, $input, 4096)) |
19 | { | |
642e522c | 20 | $status = $x->inflate($input, $output) ; |
f4c6fd49 | 21 | |
22 | print $output | |
23 | if $status == Z_OK or $status == Z_STREAM_END ; | |
24 | ||
25 | last if $status != Z_OK ; | |
26 | } | |
27 | ||
28 | die "inflation failed\n" | |
29 | unless $status == Z_STREAM_END ; | |
30 |