Help for this page

Select Code to Download


  1. or download this
        use IO::Compress::Gzip qw(gzip);
        use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
    ...
        # Create some compressed data
        my $gzipped ;
        gzip \$data => \$gzipped ;
    
  2. or download this
        my $corrupt = $gzipped;
    
    ...
    
        gunzip \$corrupt => \$uncompressed
          or print "Cannot gunzip: $GunzipError\n";
    
  3. or download this
        Cannot gunzip: Inflation Error: data error
    
  4. or download this
        # truncate the compressed data
        my $truncated = substr($gzipped, 0, 10);
    
        gunzip \$truncated => \$uncompressed
          or print "Cannot gunzip: $GunzipError\n";
    
  5. or download this
        Cannot gunzip: unexpected end of file