in reply to Re^2: File integrity checker
in thread File integrity checker

IO::Uncompress::Gunzip will check the sum for you if you set the Strict option:
gunzip 'file.gz', 'file.out', Strict=>1 or die $GunzipError;

Replies are listed 'Best First'.
Re^4: File integrity checker
by no_slogan (Deacon) on Aug 24, 2017 at 17:37 UTC
    BTW, if you want to test your error-checking code, you can break the stored checksum like this:
    open my $F, '+<', 'file.gz' or die $!; seek $F, -8, 2; my $c = getc($F); seek $F, -8, 2; print $F chr(ord($c) ^ 1);
    Running this a second time will fix the .gz file.
      That worked great. Thanks
Re^4: File integrity checker
by roperl (Beadle) on Aug 24, 2017 at 18:42 UTC
    Thanks that is helpful So how is
    my $retval = gunzip 'file.gz' => 'file.out', Strict=>1 or $GunzipError +;
    different than
    my $retval = gunzip 'file.gz', 'file.out', Strict=>1 or $GunzipError;
      It's not. The => operator is a "fat comma." (It also autoquotes its left-hand argument, which is why Strict=>1 doesn't produce a bareword warning.)