[SOLVED] how to convert a perl script *.pl to *.exe ?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would have installed different modules in my machine to convert the script.pl to script.exe if I have control over it. But, I do not have the control over installing the modules like PAR, perlcc, perl2exe etc., So,I need help in converting a *.pl script to an executable, the platform I use is Unix Solaris and I am no admin to install any new packages like PAR, perlcc etc.
Tried looking at some of the POD documents which did not help me in any way.
Is there any alternate way to convert *.pl to *.exe with the perl options ?.
Any simple suggestions with module installations would also helps.
Last edited by rpittala; 04-08-2017 at 11:52 PM.
Reason: added one more point to request
*.exe is just part of the filename. It could just as meaningfully be *.xyzzy instead.
What exactly are you trying to do with your perl script and which kind of options do you want passed to it? Usually those options are passed as runtime arguments either by you manually in the shell or via a wrapper script or by modifying the perl script's defaults.
the perl script itself will be executable if you run chmod +x on it (see man chmod). You do not need to convert it, just set that execute bit. And also add a first line - if not yet made:
My question was just straight forward as mentioned in the subject line.
let me explain you in detail, I have a perl script and I want to make the same script as an executable package so that when I give my script as an executable to a friend or freelancer they would not be able to look at my code or understand the script. But, they can have the access to the executable package.So, the user will make use of the executable but he can not have the access to the code or modify.
So, why did (and does) nobody really use this? Well, it turns out that bytecode loading is indeed faster in some (but not all) cases, but not very reliable: segfaults are quite common, and nobody so far has been able to fix it. In addition, the bytecode files are not portable between systems, or even Perl versions.
But there is another problem with Byteloader. The PMC file is actually just a normal Perl file: via a source filter, the bytecode is loaded. That's nasty, and makes using precompiled bytecode even less interesting.
Thus a sad story seemed to end, and the PMC feature was ignored, forgotten, and almost about to be deprecated... (Features aren't removed lightly in Perl - even if nobody uses it, a deprecation cycle is needed.)
There are other options for doing it as well, but I don't see anything very attractive from a use or maintenance point of view.
My question was just straight forward as mentioned in the subject line.
let me explain you in detail, I have a perl script and I want to make the same script as an executable package so that when I give my script as an executable to a friend or freelancer they would not be able to look at my code or understand the script. But, they can have the access to the execute the package.So, the user will make use of the executable but he can not have the access to the code or modify.
Scripts, including perl, are executable. See the advice given about chmod. If your goal is blocking the ability to read the source code, you'll want to use a compiled language instead. C, for example, does have PCRE libraries available so that you can continue to use regular expressions. Or else, run your program as a web back-end on a server they only access via a browser.
As far as I know, perl is an interpreted language that seems to compile parts on the fly. Some of the functions are even built around that. So it would not technically possible to compile perl to a static binary such as results from C.
About the subject line, it only mentions file names. You are always free to name a file what you want and it has no bearing on any other characteristics.
Last edited by Turbocapitalist; 04-09-2017 at 03:53 AM.
Reason: link
rpittala, this is a question of mentality, not technology.
why do you not want others to look at the code? you should think about that.
a perl script made executable will run on most linux machines, there's no need to "compile" it.
a compiled perl script might run on someone else's machine, if it uses the same architecture & operating system as you. why do that?
this is a linux forum, and gnu/linux is open source. you understand what "open source" means?
personally, i'm suspicious about every piece of software that deliberately hides its source.
My question was just straight forward as mentioned in the subject line.
no, I do not think so. Or I simply misunderstood.
Quote:
Originally Posted by rpittala
let me explain you in detail, I have a perl script and I want to make the same script as an executable package so that when I give my script as an executable to a friend or freelancer they would not be able to look at my code or understand the script. But, they can have the access to the executable package.So, the user will make use of the executable but he can not have the access to the code or modify.
see the -u option of perl, that will do something like that.
also another option could be to use shc, but not really simple.
rpittala, this is a question of mentality, not technology.
why do you not want others to look at the code? you should think about that.
a perl script made executable will run on most linux machines, there's no need to "compile" it.
a compiled perl script might run on someone else's machine, if it uses the same architecture & operating system as you. why do that?
this is a linux forum, and gnu/linux is open source. you understand what "open source" means?
personally, i'm suspicious about every piece of software that deliberately hides its source.
Yes, I agree with you as an open source user. But, as an employee of an organisation I have to deal with what the organisation had asked to do and it is vis versa process where the organisation has to deal with their clients.
I suppose, it`s not a question of mentality and it is a question of possibility in opensource as well and we already have the utilities available opensource too.
Up to my knowledge, the client has been providing us the code in executable format i.e., in JAVA code and some of them in perl executable format.
Basically, the script invokes the build process steps and executes the complete build process through command line. So, we already have the GUI to run the same.
Probably, they have the partial scripts in-place to run the same from some other tools.
Thanks. It still does not make sense on any level to me, especially since perl does not compile per se. But it sounds like you can take a look at the -u option pan64 mentioned and at the link I added above. If that's not what you mean then you'll have to explain more about these tools you are trying to fit things into.
"Don't blame Perl." (All such languages have had very-similar experiences.)
The differences between "the intended execution-environment of a <<X>>-script" (which is by definition very contextual), and "an executable," (which is by definition "context-free"), usually turn out to be insurmountable in practice.
"Apples are tasty." "So are Oranges!" But: "Apples are not Oranges!"
Both of these "equally-tasty fruits" are the products of very(!) different approaches.
... "so different, in fact, that ..." (IMHO) it really does not make sense to try to combine the two.
Each approach makes perfect engineering sense in its own intended context, but is engineering-nonsensical (IMHO) in the other.
"So ... don't push it."
Last edited by sundialsvcs; 04-09-2017 at 11:19 PM.
There are lot of utilities available in online for creating an exe out of a perl script. So, tried several options and pp(PAR::Packer) looks like a simple tool to convert. But, it generated a 32 bit compatible exe though I use 64 bit Ubuntu and Machine, nothing worked for me with the latest versions of Perl packages.
So, People here wanted to know why I need an exe etc ?
Now, my question here is why not and exe ?
Quote:
You wrote a killer
application in Perl.
But you are its only user!
Can’t get it out to the
masses. . .
Solution:
Marketing
Make it easy as hell to
run the application.
As I was not able to generate an exe I took help from one of my senior member and he created it in an hour with same PP utility. So, tried contacting him several time. But, he is on a long vacation and Now, I need to create one with out his help(its a great challenge for me. But, it is not working at all(frustrated!))
Please respond to the thread if you have any guidance in creating an exe for a perl script.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.