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

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: perl script
by Corion (Patriarch) on Jan 29, 2009 at 14:36 UTC

    You seem to want Acme::Bleach. The documentation and source code are short, but it works quite well at hiding your source code. You can even give your customer a printout of the source code and still have it protected.

      Interesting module and it works for small programs, I have to test it with larger programs, will there be any side effects because of this?.

      Vivek
      -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.

        Well, Acme::Bleach rewrites the input file, so that will be a certain side effect. Other than that, you will have to find it out.

Re: perl script
by jettero (Monsignor) on Jan 29, 2009 at 14:43 UTC

    You really can't successfully do this in perl. At most you can make it a little harder for people to produce the source, but if they're determined to do so ... they will. This is even true for C. People disassemble .exes all the time. They don't really get the nice pretty variable names back out, but they can learn enough to copy things or patch things if they're determined.

    I'm under the impression there are automated ways to get the perl source back from the obfuscated perl, automatically produced in the usual ways...

    -Paul

      This is even true for C.

      But it's easier in Perl, since the variable and subroutine names aren't lost. There's also a very strong correlation between the source form and the compiled form of the code. (Different source produce different code, different code results from different source.)

      People disassemble .exes all the time

      Not only disassemble, there are decompilers that produce c code. Naturally variable names are lost and optimizations produce changes so that the resulting source looks different to the original source, but still there is no need to go down to the hellish pits of assembly language.

      Nevertheless it is a lot easier with interpreter languages like perl to get the source back. You pay for the comfort with openness. Not a bad deal in my view

      I found the way. Using perlcc command we can crack the above scenario. Example, Consider, the perl script available in hello.pl. Command: perlcc -B -o hello hello.pl The option -B use the Perl bytecode code generator. The option -o used to make a executable file.
Re: perl script
by marto (Cardinal) on Jan 29, 2009 at 14:40 UTC
Re: perl script
by leocharre (Priest) on Jan 29, 2009 at 20:02 UTC

    Why are you trying to hide source?

    Either you have sensitive information inside your code (in which case- you're doing it wrong) or you're trying to prevent others from using or mimicking your code (if so you're doing it wrong).

    If you have sensitive info, store it in something like Cache::File or a YAML file illegible by others.

    If you think you're doing something so incredible and fascinatingly useful- you're much better off choosing a gnu license and attracting interest from your peers.

    Security by obscurity often ends up creating slow and dangerous code. See windows, for example. There's much debate about all this, by people who have great arguments, on all sides- of course.

    If you must hide source, there are no languages that are better than others. They all have strengths and weaknesses. I'm a low level intermediate in perl- I don't get the feeling you would use perl if you want to hide code.