The "checksum" is the same as the "CRC" referenced in the FAQ. The FAQ mentions example code in the CPAN distribution that shows how to calculate the CRC.
| [reply] [Watch: Dir/Any] |
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;
| [reply] [Watch: Dir/Any] [d/l] |
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. | [reply] [Watch: Dir/Any] [d/l] |
That worked great. Thanks
| [reply] [Watch: Dir/Any] |
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;
| [reply] [Watch: Dir/Any] [d/l] [select] |
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.)
| [reply] [Watch: Dir/Any] |