tone has asked for the wisdom of the Perl Monks concerning the following question:
I have a bit of an odd problem with uncompressing a .gz file. If I uncompress an Office file that has been gzipped then the Office file becomes corrupt. This is true with the old office format (doc,xls) and the new format (docx,xlsx).
If however I uncompress any other file (eg: avi,txt,bmp) that has been gzipped then there are no problems. I've tried using Archive::Extract and IO::Uncompress::Gunzip and I get the same results with both.
Here is the code I'm using for Archive::Extract:Here is the code I'm using for IO::Uncompress::Gunzip:use strict; use warnings; use Archive::Extract; my $file = "Testing.xls.gz"; my $ae = Archive::Extract->new(archive => $file); unless(my $ok = $ae->extract){ print "There was an error: $ae->error"; }
Any help with this will be greatly appreciated.use strict; use warnings; use IO::Uncompress::Gunzip qw(gunzip $GunzipError); my $file = "Testing.xls.gz"; my $out = "Testing.xls"; my $status = gunzip $file => $out or die "gunzip failed: $GunzipError\ +n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Office file becomes corrupt once extracted from gz
by MidLifeXis (Monsignor) on Oct 22, 2008 at 15:18 UTC | |
by tone (Novice) on Oct 23, 2008 at 08:50 UTC | |
|
Re: Office file becomes corrupt once extracted from gz
by kyle (Abbot) on Oct 22, 2008 at 15:24 UTC | |
by tone (Novice) on Oct 23, 2008 at 07:32 UTC | |
by Anonymous Monk on Oct 23, 2008 at 09:31 UTC |