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

Hello, I'm new to Perl, so when I say I haven't been able to find a module to create a self extracting zip file it may be because I'm not looking in the right places. So my questions are, does such a module exist, what's it's name, and for the future, where should I have looked to find it. Appreciate any help.

Replies are listed 'Best First'.
Re: self extracting zip
by Coruscate (Sexton) on Mar 12, 2003 at 20:28 UTC

    Take a look at Archive::Zip, along with this FAQ question on self-extracting zips. Note that the self-extracting bit seems to be platform-specific. Here's a link to the example script for a self-extractor.


    Update: It appears that that example does not create a true self-extractor. It merely shows the code to create a zip file, then one that will defalte the zip file for you. (ie: I believe you need perl installed on the target machine where the 'self-extactor' will be distributed). This doesn't sound very self-extracting to me, and I wonder why they even call it that...


    If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

      Thanks for the info, bummer about the self extractor. I apperciate your help.
Re: self extracting zip
by jasonk (Parson) on Mar 12, 2003 at 20:49 UTC

    Creating a self-extracting zip requires you to be able to produce a binary that will run on the platform you will be extracting on. Since this usually involves compiling, they are generally just written in the compiled language, rather than half and half. That being said, you could probably bundle up a zip file and the perl modules needed to unzip it using PAR, and create some form of self-extractor.


    We're not surrounded, we're in a target-rich environment!
Re: self extracting zip
by zentara (Cardinal) on Mar 13, 2003 at 13:01 UTC
    I don't know why people want self-extracting archives. I would never run one. One of the first rules I learned was "don't run unknown executables". That includes self-extracting archives. So think about the position you are putting the recipient in.... "should I risk running this possible trojan injector?" Everyone has unzip nowadays.
      When you download an executable than there is litle difference if you run that executable after unzipping or when you run a self-extracting archiwe. Perhaps in the case of interpreted progarms you can view the sourcecode after unzipping, but it's not that much difference - since there might be a trojan in the interpreter, or in some obfuscated part of the code.
Re: self extracting zip
by gsiems (Deacon) on Mar 14, 2003 at 19:55 UTC
    Do you need a self-extracting zip file or just a self extracting file?

    If you're trying to do this for a Unix type environment then you could create self extracting shell script (http://linux.org.mt/article/selfextract). I use this at work to create self installing patches... works nice.

    If you're trying to do this for MS Windows then I'm thinking that you might be able to combine TinyPerl (http://tinyperl.sourceforge.net) with the concept from the self extracting shell script above to get the job done. I'm thinking something along the lines of a Perl script ends with __DATA__ and is concatenated w/the (possibly uuencoded) payload and then compiled-- such that when run it pipes the data to a file and goes from there. I haven't tried this so it's just a guess...