home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / libcompress-zlib-perl / examples / gzstream < prev   
Encoding:
Text File  |  2008-11-08  |  314 b   |  20 lines

  1. #!/usr/bin/perl
  2.  
  3. use strict ;
  4. use warnings ;
  5.  
  6. use Compress::Zlib ;
  7.  
  8. binmode STDOUT;    # gzopen only sets it on the fd
  9.  
  10. #my $gz = gzopen(\*STDOUT, "wb")
  11. my $gz = gzopen('-', "wb")
  12.       or die "Cannot open stdout: $gzerrno\n" ;
  13.  
  14. while (<>) {
  15.     $gz->gzwrite($_) 
  16.     or die "error writing: $gzerrno\n" ;
  17. }
  18.  
  19. $gz->gzclose ;
  20.