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

Here is my dilemma that I am hoping somebody has a solution to. I have a self contained executable perl script that I packaged with pp. I no longer have the source code for that executable because my laptop was stolen with the source code on it. Is there anyway I can reverse the packaging process to get back the source code?

Thank you in advance.

Replies are listed 'Best First'.
Re: Reverse PP Packaging
by RonW (Parson) on Sep 03, 2014 at 16:53 UTC
    You can use zip or 7-zip to unpack the executable. 7-zip, at least, seems to be able to unpack any executable. It can be interesting to see what's "hiding" in an executable.
      is interesting..but not surprising: i tried with a packed version of my tk Tartaglia's triangle and with 7-zip you can see all the files and modules inserted in it. If i remember correctly i had a problem with the absence of libwinpthread-1.dll so i put it in the executable in this way: copied in the same dir of pp, and told pp to add (--add) ./libwinpthread-1.dll. So in the verbose output i found: pp: ... adding ./libwinpthread-1.dll as ./libwinpthread-1.dll
      c>ls -l Tartaglia.v35.exe -rwxrwxrwx 1 user group 11112739 Jun 19 11:26 Tartaglia.v35.e +xe c>ls -lr 7zip-tartataglia-exe total 82 drwxrwxrwx 1 user group 0 Sep 4 09:15 script -rw-rw-rw- 1 user group 48640 Apr 5 19:15 libwinpthread-1 +.dll drwxrwxrwx 1 user group 0 Sep 4 09:15 lib -rw-rw-rw- 1 user group 224 Jun 19 11:26 META.yml -rw-rw-rw- 1 user group 32814 Jun 19 11:26 MANIFEST c>ls -lr 7zip-tartataglia-exe\script total 54 -rw-rw-rw- 1 user group 53331 Jun 19 11:26 tk-tartaglia35. +pl -rw-rw-rw- 1 user group 704 Jun 19 11:26 main.pl c>
      HtH
      L*
      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: Reverse PP Packaging
by Anonymous Monk on Sep 03, 2014 at 18:10 UTC
Re: Reverse PP Packaging
by CountZero (Bishop) on Sep 04, 2014 at 08:12 UTC
    Rename your executable to "some_filename.zip" and unzip it.

    A pp packed script is no more than a cleverly disguised self-unpacking, self-starting zip file which contains a full perl-executable and the modules and files you need to run your script.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
Re: Reverse PP Packaging
by nanophd (Novice) on Sep 04, 2014 at 13:39 UTC

    Thank you all for the replies. Treating it as a zip file worked perfectly.