Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Perl to executable without releasing source code?

by perlnb2015 (Initiate)
on Mar 23, 2015 at 21:38 UTC ( [id://1121043]=perlquestion: print w/replies, xml ) Need Help??

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

Hi, I compiled my Perl script to an executable file using pp. The problem is, it only runs if the source code file provided with the .exe file. Is there any way (free) that I can distribute the program without releasing the source code? Thanks! Update: Thanks all for helping me here. I probably should rephrase my question. I don't worry about if the users can recover the source since the users I have are all non-IT users and I don't mind sharing the code with other ITs. This is a standalone tkx interface instead of web interfaces, therefore, I hope that I can release just ONE executable file to the users and that's it. Right now, the pp generated .exe file won't run unless I put the .pl file in the same folder (so two files). Is there any way to put everything the users needed into one .exe file? Thanks again. Update again: Just figured out that it's not because of the .pl file, it's the 'icons' folder that I added in when compiling the .exe file (pp -a "icons" ...). The executable won't run without the icon folder.
  • Comment on Perl to executable without releasing source code?

Replies are listed 'Best First'.
Re: Perl to executable without releasing source code?
by Athanasius (Archbishop) on Mar 24, 2015 at 03:46 UTC
Re: Perl to executable without releasing source code?
by eyepopslikeamosquito (Archbishop) on Mar 24, 2015 at 06:30 UTC
Re: Perl to executable without releasing source code?
by ww (Archbishop) on Mar 24, 2015 at 03:47 UTC

    Very late to the party... but IMO, the bottom line is "No, free or otherwise, you can't"

    It may be possible to so obfuscate the code (and not just in the Perl-ish sense) that reconstructing (reconstructing, not extracting!) is inordinately costly in $$$ or time for most pirates/thieves/curious/whatever (<= pick one or more) than writing new code after deconstructing your API (if any). But that's !eq to impossible.

Re: Perl to executable without releasing source code?
by Anonymous Monk on Mar 23, 2015 at 22:23 UTC
        Maybe you LanX should read the whole comment ... compiled to not bytecode its should be impossible to recover the source as its assembler
Re: Perl to executable without releasing source code?
by SuicideJunkie (Vicar) on Mar 24, 2015 at 14:28 UTC

    There is one way to keep your source code hidden: don't give it out.

    You can still have people send you input and give them back the results of your script, and keep the script itself secret by running it yourself on your own CPU. The internet is a decent transmission medium for that. Make an interface for people with HTML and CGI, keep the resulting webserver in your possession, pay the ISP bills, and you're good to go.

Re: Perl to executable without releasing source code?
by RonW (Parson) on Mar 24, 2015 at 19:35 UTC

    BTW, pp does not actually compile your Perl program. What is does is create a special Zip file containing copies of your Perl program source and as many of the modules and libraries your program depends on, and a copy of the Perl run time environment. If you open the executable with Zip, 7-Zip or similar tool, you can see all the files inside. Sometimes, pp can't determine all the dependencies. The -a option allows you to add any that pp doesn't by itself.

    When you run the executable, it automatically extracts the files into a temporary directory on your PC, then runs the extracted Perl environment, giving it the name of your program and any parameters you supplied to the executable.

      Thanks for such an easily-understood-by-beginners explanation! I guess now I finally how pp works. It really took me a long time to go though the links mentioned here and test all the methods but still feel confused.

      I wish there are always detailed information that helps beginners like me to be able to follow. For this case, I thought after 'compiling', all I need to deliver is the .exe file. I didn't know that the additional icon folder should be presented too. Information like this can save people a lot of time.

      Thanks again!

        What other questions do you have?
Re: Perl to executable without releasing source code?
by RonW (Parson) on Mar 24, 2015 at 17:37 UTC

    Are you sure you are using pp correctly?

    For me, pp -o hello.exe hello.pl created a stand-alone executable that runs on other PCs that do not have Perl installed and without needing hello.pl

    (for non MS Windows, use pp -o hello hello.pl)

      Just figured out that it's not because of the .pl file, it's the 'icons' folder that I added in when compiling the .exe file (pp -a "icons" ...). The executable won't run without the icon folder.
Re: Perl to executable without releasing source code?
by perlnb2015 (Initiate) on Mar 24, 2015 at 15:27 UTC
    Update: Thanks all for helping me here. I probably should rephrase my question. I don't worry about if the users can recover the source since the users I have are all non-IT users and I don't mind sharing the code with other ITs. This is a standalone tkx interface instead of web interfaces, therefore, I hope that I can release just ONE executable file to the users and that's it. Right now, the pp generated .exe file won't run unless I put the .pl file in the same folder (so two files). Is there any way to put everything the users needed into one .exe file? Thanks again.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1121043]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-26 09:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found