I've written some Perl programs and am planning on distributing them. They're part of a large binary distribution (mostly compiled C/C++). If possible, I'd prefer to give up as little as possible (I'm responsible for delivering working software, not delivering clever algorithms). What is my best bet for hiding the Perl code so that if someone really wants to see the source, they'd have to put a bit more effort than in than simply opening the file in an editor?
Asked
Active
Viewed 4,723 times
2
-
It is most likely because while there are occasionally some valid reasons to obfuscate Perl code, you have provided none. Unless you can provide some very specific downside examples, giving up your 'clever algorithms' is not the problem - the only downside will be to the poor guy who has to maintain your distribution 5 years from now. – ivancho Dec 07 '10 at 10:26
-
1Hey, this is perfectly valid. There is an un-obfuscated version of the Perl code living alongside the C/C++ source. This isn't an open-source project, and I don't feel that I should be forced into open-source solely by choosing Perl. – ajwood Dec 07 '10 at 14:20
-
Give a customer the source of a script doesn't make it open source. Even with the full source code for all your programs the customer still has to honor your copyright. And given that sufficiently advanced decompilers exists to turn C/C++ binaries into almost usable source code, a determined users effectively has your source code. – Ven'Tatsu Dec 08 '10 at 21:36
-
1Sure, but if I'm not obligated to give them the code I'm not sure why trying to avoid it is such a bad thing. Having the question voted down makes me think that there is something seriously wrong with what I'm proposing. – ajwood Dec 09 '10 at 00:44
-
1. Invalid reason: "I don't want the customer to use my clever algorithms in their own code" 2. Valid but really unpleasant reasons: "I don't want the customer to see how bad my code is", "I would like to charge later for consulting even though my Perl code is easy to figure out and maintain" 3. Valid reason: "My customer likes to tweak my scripts and often breaks stuff which I then have to fix for no extra money" – ivancho Dec 10 '10 at 06:21
-
Ouch, a new downvote? Is there no statute of limitations on these things? ;) – ajwood Jul 29 '15 at 12:45
4 Answers
4
You could encrypt your code and then at run time decrypt it and send it to perl
stdin
. (of course the decryptor would not be encrypted).
I got some minify/compile answers to my question How can I compile my Perl script so to reduce startup time?

Community
- 1
- 1

700 Software
- 85,281
- 83
- 234
- 341
3

bob.faist
- 728
- 7
- 16
-
I see on another forum that "The only problem with Acme::Bleach is the script is suddenly non portable". – ajwood Dec 13 '10 at 15:07
3
Filter::Crypto (potentially via PAR::Filter::Crypto) is clearly the most advanced open source tool for this job (barring perlcc which doesn't work well for many things, YMMV).
If all you want is hide the code from casual tinkerers, that's more than sufficient. Hiding it from determined and/or capable people is practically impossible.

tsee
- 5,034
- 1
- 19
- 27
2
It won't make it harder to just open the files but an obfuscator can make it more difficult to understand and modify your code. Have a look here or here for a start.

terminus
- 13,745
- 8
- 34
- 37
-
7A perl obfuscator seems like a redundancy based on the way some people write perl. – Paul Tomblin Dec 06 '10 at 19:54
-
@Paul I was about to suggest the same but I don't really want the wrath of perl fans :) – terminus Dec 06 '10 at 19:55
-
1@Paul - Are you suggesting that the OP deliberately make his code unmaintainable? It's (presumably) a real job, not code golfing contest :) – DVK Dec 06 '10 at 19:58
-
@DVK, no, I'm suggesting he turn the coding over to some of my co-workers. – Paul Tomblin Dec 06 '10 at 20:00
-
2@terminus - that depends. If you do it tongue in cheek and show that you actually have a clue that good software developer can write readable code in any language including Perl with equal ease, the fanboyz will be laughing with you (see infamous Schwern's comment) - which is the case with Paul's comment. If you act like a troll and imply that a set of random code most likely NOT written by professional software developers implies something about capabilities of language as a whole, people who do have a clue will come down on you like a Mongol tumen. – DVK Dec 06 '10 at 20:01
-
@DVK Yeah, the language barrier makes it harder for me to be tongue in cheek. I don't want to risk becoming and accidental troll. – terminus Dec 06 '10 at 20:03
-
2@Paul - I'll swap you some of your geniuses for some weirdos who wrote C++/C hybrid that I have the misfortune of maintaining currently. I mean I knew THEORETICALLY you can develop in write-only C++... – DVK Dec 06 '10 at 20:03
-
1@DVK I raise you with the weirdo who can write Python code like Perl code... And Perl code like Assembly. – terminus Dec 06 '10 at 20:06
-
@terminus - OK, the last one I can believe. The firts one, I GOTTA see :) By the way, the Schwern reference in prior comment was: http://stackoverflow.com/questions/234075/what-is-your-best-programmer-joke/273868#273868 – DVK Dec 06 '10 at 20:10
-
@DVK "Besides, the determined Real Programmer can write Fortran programs in any language." This might as well be true for Perl programmers. :) Also, the first comment to that answer is pure gold. – terminus Dec 06 '10 at 20:14