in reply to Compiling Perl?

This has been discussed before (link anyone?) but if you don't want to put it into C, all you can do is obfuscate the code. Remove newlines, add random spaces, give variables really odd names, etc. You could also "cripple" it a bit - in other words, don't write the best code that you can, but leave in some errors and inefficiencies. Be redundant. The bottom line is that your code can be read, you just have to decide how much trouble you want to make it to do so.

Replies are listed 'Best First'.
RE: Re: Compiling Perl?
by neshura (Chaplain) on Apr 29, 2000 at 03:39 UTC
    I remember the link. I think it was Protecting Perl Code. It was a slightly different issue -- this monk is concerned about a particular thievery-prone person, as opposed to the earlier monk who seemed to just be generally paranoid.

    I'm curious why SuperCruncher wants the other person to have a copy of the application at all -- is a face-to-face demo impossible or impractical?

    Stealing code against the author's wishes is SO gauche.

    Frankly, I'm not sure of what the best solution is. If the script is really big, I guess you'll have to compile it -- other people have actual technical suggestions on how to do this. Personally, I think it would be rather fun to go through the code and make it mostly-workable but wrong and bad and inefficient. Use . instead of join, s instead of tr, arrays instead of hashes. Put everything in one big object. Lowercase your filehandles and capitalize your subroutines. Indenting is a sign of brain fever. Use local when you mean my. (I could get carried away with this...)

    e-mail neshura

      I'm curious why SuperCruncher wants the other person to have a copy of the application at all -- is a face-to-face demo impossible or impractical?
      He wants a copy of the program. Fine. No problem. But I don't want to give him the code, because with a little bit of modification, he could easily remove the "dumbed down"-ness and use it in competition with me. I just want him to use this for his own personal use.

      Stealing code against the author's wishes is SO gauche.
      Put people do it! And I don't want this code to be stolen!

        As to your assertion that people steal code all the time, I can't speak to that, as I don't know all people or all code well enough to judge. Your original question was technical in nature rather than philosophical, and I'm very sorry I can't give you more assistance (I have never had an occasion to compile my code in order to protect it).

        It seems to me that since your only practical choice is to compile the code, that you probably ought to go back to the source, namely - ActiveState and/or C. I'm fairly sure that there is no magic-bullet answer to be found from the Perl side of things.

        Best of luck to you!

        They steal code? They do? Really? In Perl? 99% of the things Perl is used for you can download it somewhere. And, the power is being able to update the code, to shift with the market, to add new functionality. If they "steal" you code, a good programmer will just add some kickin' new features, and leave them in the dust. Anyways, you'll not helping somebody much by giving them a compiled version. If they're worth assisting, then you can give them the benefit of the doubt. If they've actually stolen from you before, giving you cause to worry, then you wouldn't want to help them anyway.
Re: Compiling Perl?
by SuperCruncher (Pilgrim) on Apr 29, 2000 at 01:13 UTC
    This has been discussed before (link anyone?)
    I read previous discussions and Q&As at this site before I posted. Some of the Q&As were just verbatim copies of the standard perlfaq man pages!

    I appreciate your suggestion, but I'd hoped there was a better solution. I'll keep it as a last resort though.

    I have no problem with compiling into C, when I said I didn't like it, I meant for coding. If the code produced by perlcc compiled by me just typing:

    gcc -I /include/path/ whatever.pl.c -o mybinary.exe

    then I'd be very happy. But I get compiler errors. Perlcc does not even appear to be writing syntactically valid code!