EnderPax has asked for the wisdom of the Perl Monks concerning the following question:

I want to take a Windows, self-extracting zip file and uncompress it. The uncompressing will be done on a Windows NT system. The archive was created by WinZip.

I know there are free command line tools out there which would allow me to do this with a simple system() call. But I'm curious as to whether it is possible to use Compress::Zlib (or something else unknown?) to take a WinZip .exe and get at the files on the inside with Perl.

If anyone wants a sample Winzip self-extracting archive to work with, go here.

Thanks for any help!

Replies are listed 'Best First'.
(Ovid) Re: Uncompressing ZIP Files
by Ovid (Cardinal) on Dec 16, 2000 at 03:44 UTC
    I believe you want Archive::Zip. I have used it successfully, but have not used it on a self-extracting zip archive (though I suspect there will not be a problem).

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

      Thanks, Ovid.

      I feel most silly for not having gone to CPAN myself for this.

      I will learn....

Re: Uncompressing ZIP Files
by footpad (Abbot) on Dec 17, 2000 at 04:04 UTC
    EnderPax,

    Um, if it's really a WinZip self-extracting ZIP file, why not use system() to let it uncompress itself? For example:

    #!/usr/bin/perl my $sfxfile = "samples.exe"; system( "$sfxfile" ) == 0 or die "Can't unzip $sfxfile";

    This is pretty much the same code found in perlfunc:system and worked on my system (Win98) with an sfx created with WinZIP 7, SP1.

    --f
      Perhaps they want to unzip it on a non-winXX system?

      a

        a,

        Good point, though the original poster specifically mentioned WinZIP.

        --f