Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

converting perl to machine language

by Ganesh Bharadwaj1 (Sexton)
on May 04, 2016 at 07:29 UTC ( [id://1162151]=perlquestion: print w/replies, xml ) Need Help??

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

Hi Monks, I want to pass some perl scripts I have created to other colleagues. I dont want them to see what is written inside, since there are some confidential information. I want to know how I can convert the perl scripts to machine language. So, that they can execute the perl script as normal without actually being able to read what is written inside. Any help would be appreciated. Do I write something in shell to convert the perl to machine language? thanks, regards, Ganesh.

Replies are listed 'Best First'.
Re: converting perl to machine language
by GrandFather (Saint) on May 04, 2016 at 07:46 UTC

    Short version: you can't.

    Slightly longer version: even if you could it doesn't prevent a keen competent person reverse engineering your intellectual property.

    Longer version: although much of Perl could be compiled into a machine language form, parts of Perl require the interpreter to be available at run time (string eval for example). There are various packing tools such as PAR that pack up your source code along with the Perl interpreter and any required modules into a stand alone application, at the cost of a fairly large "code" overhead and the runtime overhead of unpacking everything before your code can run.

    This question comes up fairly frequently starting quite a long time ago (see Compiling Perl for example) and the answer hasn't changed a lot over the years.

    Premature optimization is the root of all job security
      thanks a lot for the detailed answer.
        See also Re^3: Code hiding in Perl by afoken who explains with even more details why you cannot

        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: converting perl to machine language
by Athanasius (Archbishop) on May 04, 2016 at 07:34 UTC
Re: converting perl to machine language
by Corion (Patriarch) on May 04, 2016 at 07:36 UTC
      The people who are using the perl script are just laymen. So a basic encryption will do. What do you suggest?

        I already linked to PAR::Packer, as this is what I recommend.

Re: converting perl to machine language
by Marshall (Canon) on May 04, 2016 at 16:17 UTC
    When I distribute .exe files, I use my Active State Dev Kit to make the .exe. This license does cost money, a major downside. I am not aware of a freeware solution that provides the same level of "source code security".

    A determined hacker can indeed find the source code in an Active State executable, but this is not trivial. The average guy out there cannot do it. Due to a massive server meltdown on multiple machines, I lost the source code for one of my Perl.exe's. I eventually gave up and wasn't able to recover the source code although I had a current .exe. There is a way to do it and it has been done however, it is not "easy".

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 04:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found