summaryrefslogtreecommitdiff
path: root/cpan/Compress-Raw-Zlib/examples/filtdef
blob: 3c6565042f05c69dfd8897868cc54c7b49ff375c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/local/bin/perl

use Compress::Raw::Zlib ;

use strict ;
use warnings ;

binmode STDIN;
binmode STDOUT;

my $x = new Compress::Raw::Zlib::Deflate()
   or die "Cannot create a deflation stream\n" ;

my $output = '' ;

while (<>)
{
    $x->deflate($_, $output) == Z_OK 
        or die "deflate failed\n" ;

    print $output ;
}

$x->flush($output) == Z_OK
    or die "flush failed\n" ;

print $output ;