How to set the script execution directory in Padre debugger? - perl

How to set the script execution directory?
For example, the script main.pl is located in a scripts/ directory. The file to be processed is data.txt, located in a data/ directory.
Then, cd data/ and invoke the script using ../scripts/main.pl -i data.txt
When debugging the script in Padre debugger, the execution directory is the script's location scripts/. The command args -i data.txt can be set through the Preferences dialog, but in order for this to work, it needs to be changed to -i ../data/data.txt
How can one set the execution directory ti be other than the script's location?

How can one set the execution directory to be other than the script's location?
According to the comments, you seem to be running Padre version 0.94 for Windows, then apparently it is not possible to set the directory (at least from the GUI).
However, the feature seems to have been added to Padre later. I installed Padre version 1.00 on my Ubuntu 18.10 laptop running Perl 5.29.8 (with thread support). Then there is an option
"Run in directory" from the "Debug launch Parameters" dialog where you can set the script execution directory.

Related

Can we run a Perl script in a browser without web server?

Is it possible to run a perl script in Activeperl without web server in windows 7.If possible what are the steps to follow?
I have simple registration form using Post method in HTML file.I'm using this HTML file in my .pl file.I'm using CGI module. While running the .pl file from the command promt the HTML file is running browser, after clicking submit button the perl script is displaying.
When you install ActivePerl, it creates a file association for .pl files, so simply double-clicking a .pl file in Explorer ("My Computer", "File Explorer", etc) will run it. This also makes it so you can run script.pl from the Windows Command Prompt.
When you install ActivePerl, it modifies your PATH to include the directory that contains perl.exe, making it so you can run perl script.pl from the Windows Command Prompt.
Finally, you can always run c:\...\bin\perl script.pl from the Windows Command Prompt.
Can you explain a bit more the exact use-case?
I think the first user in the comments gave you the best answer.
If Perl is not in your PATH environment you need to associate .pl extensions with Perl or run it via command-line ( if I remember correctly Active-Perl comes with a Perl command line tool )

Epic ( Eclipse ) Perl not working

I have installed Epic in my Eclipse to run perl scripts. Unfortunately, iam getting the below error while trying to run the script.
Failed to execute command line: "perl" "-v"
Cannot run program "perl" (in directory "."): CreateProcess error=2, The system cannot find the file specified
When i tried to run "perl -v" in command prompt, it worked fine on the day i installed Epic. After restarting, the command does not work and the folder C:\Dwimperl became empty.
Note : The script did not run and showed the same error in eclipse even on the day i installed Epic.
I am using Windows 7, Eclipse Luna Release 2(4.4.2), and Perl 5 (before restart, now deleted)
These are the contents of my System PATH
E:\app\mevenk\product\12.1.0\dbhome_1\bin
C:\ProgramData\Oracle\Java\javapath
%SystemRoot%\system32
%SystemRoot%
%SystemRoot%\System32\Wbem
%SYSTEMROOT%\System32??\WindowsPowerShell\v1.0\
C:\Program Files (x86)\Sony\VAIO Startup Setting Tool
%JAVA_HOME%\
C:\Program Files (x86)\QuickTime\QTSystem\
C:\Program Files (x86)\Skype\Phone\
%M2_HOME%\bin
If not already done, In the eclipse perl EPIC preferences you need to set the full path to your perl interpreter:
e.g. In my Eclipse I have:
Window -> Preferences-> Perl EPIC-> Perl executable = "C:\DEV\TOOLS\perl\perl\bin\perl.exe"
Problem resolved after installing ActivePerl.
The problem is with perl Interpreter given with Epic (Dwimperl) which did not set the PATH variables and installables properly.
After installing ActivePerl, Eclipse took its path variables.
C:\Perl64\site\bin;C:\Perl64\bin;
Now, perl scripts working fine in Eclipse.

Can't get eclipse to run terminal command on mac

I have installed swig on my mac and it works in the console just fine. If I type swig -verison in terminal it spits out the version. Eclipse keeps telling me that it can't find swig. I am using the liquidfun library http://google.github.io/liquidfun/SWIG/html/index.html and it told me to put this export SWIG_BIN=$("which" swig) in .bashrc, which I did. This enviroment variable registers through terminal as well. Eclipse STILL won't grab swig properly. What the hell?
Bash reads .bash_profile, .bash_login or .profile. I don't expect the Eclipse process to load such a file (although I could be wrong) nor the SWIG_BIN variable to augment its search path for executables, but if you launch Eclipse from the shell, it should inherit the shell's environment variables.
Try running swig from eclipse using a full absolute path (the one that "which" returns).
The eclipse.ini file can set some startup parameters but perhaps not the path. There might be other eclipse startup files.
Another possibility is to add swig's directory to the path in a login script. (To test that, log out and back in, then start eclipse.)

How to get $HOME in MinGW to not be /c

Any chance that being logged in as Administrator would change how mingw installs? I am running XP. My home directory turns out to be /c, not something in /home`.
Details: Having failed once, I removed MinGW package (mingw-get-inst-20120426) then reinstalled it. During the install of MinGW I chose every option and elected to download latest packages.
I checked my Start->Programs->Mingw->MinGW Shell properties. it is starting C:\MinGW\msys\1.0\msys.bat and the start-in directory is C:\MinGW\msys\1.0\bin. I have determined that / is C:\MinGW\msys\1.0.
But when I run the bat, at the mingw prompt echo $HOME says /c. And there is no directory named /home. echo $USERNAME = Administrator.
Can someone tell me what I did to end up with no $HOME? Do I need to make a *nix user? Or perhaps remove migw and create an XP user and use that user to reinstall mingw?
This was caused by having a Windows environment variable named HOME. It was a leftover from somehting unrelated. Once I deleted it and reinstalled mingw (without deleting the existing one) my home became /home/Administrator. Pity about the capital A, though.
In msys type cd ..
Now you're in a not really existent directory /home .
If you type cd usr
Now you're in a not really existent directory /home/usr .
you will not find home or usr in your c:\msys\1.0 directory.
MSYS is a collection of GNU utilities such as bash, make, gawk and grep to allow building of applications and programs which depend on traditionally UNIX tools to be present.
An example would be building a library that uses the autotools build system. Users will typically run "./configure" then "make" to build it. The configure shell script requires a shell script interpreter which is not present on Windows systems, but provided by MSYS.
A common misunderstanding is MSYS is "UNIX on Windows", MSYS by itself does not contain a compiler or a C library, therefore does not give the ability to magically port UNIX programs over to Windows nor does it provide any UNIX specific functionality like case-sensitive filenames.
My case: I could not find ~/msys/1.0/home/user (user is my user name)
It is resolved - the following is what I discovered.
MinGW/MSYS usually creates a home folder under C:/MinGW/msys/1.0/home/user if you install them as usual (accepting the defaults) and you executes msys.bat successfully. However, it does not create if you happened to have an environment variable called HOME. I think it was a left over from my old project.
First, check your home folder by $pwd -W ($ is a command prompt.)
Remove HOME environment variable.
Reboot
Execute msys.bat again.
Now, check where your home folder by $pwd -W
Note: Don't need to reinstall MinGW/MSYS.
(a debtor)<><

Perl execution from command line question

I replaced ActivePerl with Strawberry Perl on my WinXP last week.
I found I must run my Perl script with the command of perl myperl.pl; otherwise I only need run myperl.pl before install Strawberry. How can I only run myperl.pl as before?
I checked my environment configuration as below.
C:\> Path
C:\Program Files\ActiveState Komodo Edit
5\;C:\Perl\site\bin;C:\Perl\bin;C:\Perl\bin\;C:\Program Files\CodeSynthesis
XSD 3.2\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\Microsoft
SQL Server\90\Tools\binn\;C:\Program Files\Common Files\Thunder Network\KanKan
\Codecs;C:\strawberry\c\bin;C:\strawberry\perl\bin`
Strawberry Perl path already listed in the Path value after install successfully.
Anything I missed? Thank you for your suggestion.
Try from command prompt:
assoc .pl=PerlScript
ftype PerlScript=c:\strawberry\bin\perl.exe %1 %*
--
kmx
You need to associate .pl file extension with Strawberry Perl's executable (it's a Windows thing, not a Perl thing).
To do so, there are a couple of ways (you can google or ask on ServerFault for the best one or full list), but the one I usually use on XP is:
Open any folder Windows Explorer
Go into "Tools" menu, and click on "File Types" tab in the resulting dialog
Find "PL" extension in the list
If it's there, correct the associated executable to be Strawberry Perl's .exe by clicking on "PL" line and clicking "Change" button
If it's not in the list, click "New" button, type in PL extension in the form and click "OK". Then close the whole dialog, and re-open it again. The "PL" extension will now be in the list, so click on it and click "Change" button
In case I messed up, here's the official instructions from Microsoft:
http://support.microsoft.com/kb/307859
UPDATE
Please see kmx's answer - his method is all-command-line and as such seems much more preferable to me that GUI blundering... I confirmed that it works too (without parameters, at least)
You might need to put the .PL extension into the PATHEXT environment variable. This will make .pl files work with the PATH variable.
Type
set PATHEXT
to see if you're set up. If you're not, then go to My Computer->properties->Advanced and press the "Environment Variables" button on the bottom of the tab. There you can add .PL to the PATHEXT variable.
OR you could just set it in some batch file that you run to initiate cmd:
set PATHEXT=%PATHEXT%;.PL
For completeness here's 2 other methods that don't make a .pl script executable, but you could use them to make your perl script into an executable.
pl2bat which is suppose to create a wrapped version of your .pl into a .bat file which would be executable on a windows system. I haven't tried this so YMMV.
pp, part of the PAR::Packer module which I have used before works pretty well at rolling your perl scripts into executables.