Mike:

On Thu, Dec 4, 2014 at 7:15 AM, Mike Flannigan <mikef...@att.net> wrote:
> This is a very old problem that apparently still
> persists.  Some or all gzip files created on
> Unix can't be unzipped by Archive::Zip (1.38).
>
> There are tons of old posts from 2005 that mention
> this problem, but apparently it is not an easy
> fix.  Here is one link:
> http://www.perlmonks.org/?node_id=445999
>
> The gzip files open fine on my win7 machine when I
> double click them (probably uses Winzip), but
> Archive::Zip cannot open them.
>
> Does this happen for all people on all OS, or does
> it work for some people and some situations?

I think that you are just confused about "gzip" vs "zip". These are
not the same format at all, and are not compatible. See
http://wikipedia.org/wiki/Gzip and
http://en.wikipedia.org/wiki/Zip_(file_format). I think that they use
the same compression method internally, but the structure of the files
is different. "WinZip" is just capable of opening different types of
archive files (it isn't limited to zip files). BTW, 7-Zip is a free,
libre, open source alternative for Windows that can also open up most
kinds of archive (I believe it is also available for *nixes, but there
are other free software tools on those platforms already).

I am unfamiliar with Archive::Zip, but I'm guessing that it is
designed to only work with ".zip" files. In order to open a gzip file
(typically suffixed .gz) you will need a different module. Your
perlmonks link suggests Archive::Tar. That said, tar is yet another
file format used to create a single-file archive of a set of many
files. The gzip format itself can only compress a single file. It
cannot acrhive many files into a single file so tar and gzip are
combined. The zip format by comparison does the archiving and
compression in one format.

Tar archives, typically called tarballs, are usually combined with a
compression mechanism to produce a compressed tarball. Modern tar
utilities usually have support built in to invoke appropriate
compression tools (gzip, bzip2, and xz are common compression methods
in *nix). See http://en.wikipedia.org/wiki/Tar_(computing). Note that
the gzip format is only used to compress a single file. If the
contents of your gzipped file represents many files then it likely is
a tarball (.tar) wrapped in gzip (.gz). These files are often suffixed
with .tar.gz or .tgz, but that isn't necessary.

If the file that you are trying to decompress is not actually a
tarball then perhaps you will want to use a module that isn't meant
for tarballs, and is used only to decompress the gzip format. I'm not
sure which one will suit you best, but a good starting point would be
searching metacpan.org for gzip: https://metacpan.org/search?q=gzip.
There appears to be several modules that support the format (which
isn't surprising since gzip is originally a Unix-ism as is Perl).
There is also an Archive::Any that claims to work as a magical
dispatcher to automatically do the right thing for supported formats.
You could try that, though again I don't know if it would support raw
gzip files that don't contain tarballs.

If you still need help let us know what you're trying to do and we'll
do our best to guide you to a solution.

Regards,


-- 
Brandon McCaig <bamcc...@gmail.com> <bamcc...@castopulence.org>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bambams.ca/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to