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

Can I use Archive::Zip to create a self-extracting exe for Windows? Does anyone know of a way to do this?
  • Comment on Can I use Archive::Zip to create a self-extracting exe for Windows?

Replies are listed 'Best First'.
Re: Can I use Archive::Zip to create a self-extracting exe for Windows?
by davidrw (Prior) on Aug 26, 2005 at 03:24 UTC
    I went to the Archive::Zip docs, did a find for "self" and found this snippet under the writeToFileHandle() method:
    ... this could be used (for instance) for making self-extracting archives. However, this only works reliably when writing to a real file (as opposed to STDOUT or some other possible non-file). See examples/selfex.pl for how to write a self-extracting archive.
    direct link: http://search.cpan.org/src/SMPETERS/Archive-Zip-1.16/examples/selfex.pl
      If you use PAR to package your resulting script/data then you can distribute the self extracting archive to non-perl users.
Re: Can I use Archive::Zip to create a self-extracting exe for Windows?
by johnnywang (Priest) on Aug 26, 2005 at 05:50 UTC
    yes, I just did it this week for one of my win32 backups, almost directly from the perldoc:
    use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); my $zip = Archive::Zip->new(); $member = $zip->addFile( 'xyz.pl'); die 'write error' unless $zip->writeToFileNamed( 'someZip.zip' ) == + AZ_OK;