On a Unix/Linux box you would run the script using perl script.pl and then you can examine the exit code using echo $? Examining exit code in Perl. If you happen to execute one perl script from another, for example using the system function, Perl has the same variable $? Containing the exit code of the 'other program'. The first thing most programmers learn how to do in a new language is to instruct their computer to print a 'Hello, World' message to the screen.It's traditional. You'll learn to do something similar — but slightly more advanced — to show just how easy it is to get up and running with Perl. The first thing most programmers learn how to do in a new language is to instruct their computer to print a 'Hello, World' message to the screen.It's traditional. You'll learn to do something similar — but slightly more advanced — to show just how easy it is to get up and running with Perl. Is there a way to get an absolute path to the Perl executable for the current process? $^X will give me the Perl executable name, but the doc states that it will sometimes be a relative path, and this seems to be true on OS X for example.
Active2 years, 5 months ago
I have a
.pl file and I want to execute that file in any system even though perl is not installed. How can i achieve it?
Can any one let me know with some good examples to do that?
Sinan Ünür
109k1515 gold badges178178 silver badges315315 bronze badges
User1611
47122 gold badges1414 silver badges2727 bronze badges
9 Answers
pp can create an executable that includes perl and your script (and any module dependencies), but it will be specific to your architecture, so you couldn't run it on both Windows and linux for instance.
From its doc:
To make a stand-alone executable, suitable for running on a machine that doesn't have perl installed:
(% and $ there are command prompts on different machines).
ysthysth
80.4k55 gold badges101101 silver badges196196 bronze badges
This would work only on the OS where it was built.
P.S. It is really hard to find a Unix clone without Perl. Did you mean Windows?
Alexandr CiorniiAlexandr Ciornii
6,97311 gold badge2222 silver badges2828 bronze badges
From perlfaq3's answer to How can I compile my Perl program into byte code or C?:
(contributed by brian d foy)
In general, you can't do this. There are some things that may work for your situation though. People usually ask this question because they want to distribute their works without giving away the source code, and most solutions trade disk space for convenience. You probably won't see much of a speed increase either, since most solutions simply bundle a Perl interpreter in the final product (but see How can I make my Perl program run faster?).
The Perl Archive Toolkit ( http://par.perl.org/ ) is Perl's analog to Java's JAR. It's freely available and on CPAN ( http://search.cpan.org/dist/PAR/ ).
There are also some commercial products that may work for you, although you have to buy a license for them.
The Perl Dev Kit ( http://www.activestate.com/Products/Perl_Dev_Kit/ ) from ActiveState can 'Turn your Perl programs into ready-to-run executables for HP-UX, Linux, Solaris and Windows.'
Perl2Exe ( http://www.indigostar.com/perl2exe.htm ) is a command line program for converting perl scripts to executable files. It targets both Windows and unix platforms.
brian d foybrian d foy
105k3030 gold badges178178 silver badges485485 bronze badges
Look at PAR (Perl Archiving Toolkit).
PAR is a Cross-Platform Packaging and Deployment tool, dubbed as a cross between Java's JAR and Perl2EXE/PerlApp.
Jared OberhausJared Oberhaus
12.6k44 gold badges4848 silver badges5353 bronze badges
And let's not forget ActiveState's PDK. It will allow you to compile UI, command line, Windows services and installers.
I highly recommend it, it has served me very well over the years, but it is around 300$ for a licence.
Mathieu LongtinMathieu Longtin
6,38166 gold badges2121 silver badges3232 bronze badges
Note to Sinan and brian: perlfaq3 is still wrong.
See http://search.cpan.org/dist/B-C/perlcompile.pod
rurbanrurban
RickRick
39111 gold badge66 silver badges2121 bronze badges
Perl files are scripts, not executable programs. Therefore, for them to 'run', they are going to need an interpreter.
So, you have two choices:1) Have the interpreter on the machine that you wish to run the script, or2) Have the script running on a networked (or Internet) machine that you remotely connect to (ie with a browser)
David Lewis
On MaxOSX there may be perlcc. Type man perlcc. On my system (10.6.8) it's in /usr/bin. YMMV
See http://search.cpan.org/~nwclark/perl-5.8.9/utils/perlcc.PL
Perl To Executable Linux
Klaas Z4us VKlaas Z4us V
Not the answer you're looking for? Browse other questions tagged perl or ask your own question.
Active4 years, 2 months ago
I am trying to run a run.pl file form the OpenDroneMap directory using the command
./OpenDroneMap/run.pl from within the Photos directory however I keep getting a Bash error.
Would there be any reason I can't run this command?
kos
27.2k99 gold badges7373 silver badges128128 bronze badges
Leith HawkinsLeith Hawkins
2 Answers
Bash will always try to interpret scripts / text files as a sequence of Bash commands, unless the script / text file itself has a shebang at the start of the file describing which executable has to be run in order to interpret it; either add a shebang at the start of the file explicitly telling Bash to run the script using Perl:
This will be useful to students in schools and universities aswell as professionals. Madura dictionary download sinhala. Version 2006 includes unspecified updates.How Install This Software?01.Now Install Madhura English Sinhala Dictionary to computer.02. It includes complete glossaries of technical terms coveringmedicine, science, law, engineering, accounts, arts and many othersources. You can find the exact Sinhala meaning ofany English word and the exact English meaning of any Sinhala wordeasily.
Or run the script using Perl:
To not follow a reverse SCITE approach (i.e. to not edit answers posted earlier based on other users' answers posted later), since this is now the accepted answer I'll edit in part of what OleksDovz said in its answer, which is: if you're running the script using koskos
./OpenDroneMap/run.pl , make sure that the script has both a shebang at the start of the file and the executable flag set for your user; if you're the owner of the file run:
27.2k99 gold badges7373 silver badges128128 bronze badges
check if shebang exists in first line, Like '#!/usr/bin/perl'and add to this file +x bit:
Perl Path To Executable
or just use perl for script
After that you can run
OleksDovzOleksDovz
Perl Executable Not Found RNot the answer you're looking for? Browse other questions tagged command-linebashperl or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |