Is it possible with Padre to run and debug Perl scripts with a different Perl version? - perl

Padre is a (open) IDE for Perl that does look promising.
Since Padre is written in Perl itself, it is not apparent whether it's easily possible and practicable to run and debug Perl scripts in this IDE that are running on a different Perl version than the IDE itself.
As an example, say I download the current installer (for Windows) which will install and run Padre on Strawberry Perl 5.12 -- can I then use this IDE to run+debug my scripts that are running on ActiveState Perl 5.8.9? (Yes, and I want them to run exactly on AS+5.8.9 because this is where they'll run in production.)
I am aware that there is a Padre package for AS+5.8.9 but I would much rather install the default IDE package and have the IDE run on the Perl it normally runs on and have my scripts run on the Perl they normally run on.
Insights?

Under Tools->Preferences->Language - Perl 5 you can specify the perl binary as well as its parameters to run your projects.

Related

How to run perl or shell scripts in windows in secured environment without strawberry perl or Cygwin

I need to write perl or shell scripts in windows environment for automation. Please suggest some freeware.
For perl I tried padre perl but post installation it requires connection with CPAN which my proxy doesn't allows.Hence its unable to identify modules once I run perl scripts.
Also for running Shell scripts I tried cygwin but its unable to identify loop statements while running shell scripts.
How should I go ahead?
Thanks in advance!
Why you don't use Activestate? I think is the best perl packaged system for Windows.
Here's the link for the free community edition:
http://www.activestate.com/activeperl/downloads
As for editors, you can also use Komod Edit: http://komodoide.com/komodo-edit/

Perl for Windows for Eclipse syntax checking that contains EXPECT and SWITCH?

We are running a CentOS Linux server, on which Perl 5.8.8 is installed. We cannot update Perl on this system.
I am installing Eclipse with EPIC to do some Perl coding onto my Windows 7 workstation. This requires that I install Perl on the workstation as well. I've installed a few different versions of Perl and they all have issues for us... Our code makes use of the Switch and Expect commands.
Strawberry Perl 5.8.8.4 has Switch.pm, but not Expect.pm.
DWIM Perl 5.14.2.1 does has Switch.pm, but can't locate it. It also doesn't have Expect.pm.
ActivePerl 5.16.3.1604 has Switch.pm, but can't locate it. It also doesn't have Expect.pm.
Can someone recommend a Perl that I can install on my workstation that will provide these modules? Alternately, is there a way to install these modules?
Try this with strawberry perl:
perl -MCPAN -e 'install Expect'
This is somewhat answered by Expect - Can I use this module with ActivePerl on Windows?
Up to now, the answer was 'No', but this has changed.
You still cannot use ActivePerl, but if you use the Cygwin environment (http://sources.redhat.com), which brings its own perl, and have the latest IO::Tty (v0.05 or later) installed, it should work (feedback appreciated).

How to install pp (PAR Packager)?

I have to create an exe from a Perl script. I installed
ActivePerl-5.14.2.1402-MSWin32-x86-295342.msi
How do I install pp?
I know this is a relatively old question, but for the sake of others, here is a solution that worked for me using pp (Par Packager):
Install Strawberry Perl for windows (I installed strawberry-perl-5.16.3.1-64bit.msi)
I used 5.16.3.1 because I wanted to try out perl2exe as well, while I'm at it (perl2exe at the time supported only up to 5.16.3 version of perl)
Once installed, open Strawberry Perl Tools (e.g. through start menu -> All programs -> Strawberry Perl -> Tools), and invoke CPAN Client
In the client console that opens, type:
get pp
install pp
Once installation is complete, you can simply run:
c:\strawberry\perl\site\bin\pp.bat -o myScript.exe myScript.pl
Which will produce a myScript.exe which is a standalone executable (no external perl interpreter is needed)
Note: You can use the -d command line switch in order to reduce the size of the executable. This will not include perl interpreter code inside the executable, reducing the size of the executable, however you will need to provide perl5x.dll in the same directory as your executable, or include it on the PATH environment variable.
Until the issue with 1.010 is fixed, do the following:
Go to http://search.cpan.org/dist/PAR-Packer/
From the "Other releases" drop down list, select PAR-Packer-1.009 and download it
Decompress the archive, preserving directory structure
Run perl Makefile.PL
Install all the missing prerequisites by hand using ppm. E.g., ppm install Module::ScanDeps etc
Install MingW: ppm install MingW
dmake, then dmake test, then dmake install
Later, you can remove PAR::Packer from the site area using the ppm GUI and install the fixed version.
This is a Perl module called PAR::Packer, so it can be installed as any Perl module with CPAN. Unfortunately, you're using ActivePerl which isn't quite compatible with CPAN. Instead, you can see if use ActiveState's Perl Package Manager to install this module.
If the module isn't available via the Perl Package Manger, you can try installing with the CPAN command line utility. Open up a Console Window (Start->Accessories->Command Prompt) and type in cpan and press <ENTER>. Newer versions of ActiveState should automatically install the required compilers, etc. when you first start to use CPAN.
I prefer Strawberry Perl for Windows because it's more compatible with CPAN. However, ActivePerl has a lot of the Win32 modules already installed. Plus, it comes with the Perl Package Manager which is nice.
WARNING: ActiveState installs a lot of these Perl scripts not in C:\Perl\bin, but in C:\Perl\Site\bin which means you have to make sure that directory is in your path too.
As of v1.010, the software cannot be automatically packaged, see the report at Trouchelle's repo.
Install CPAN using PPM, then continue as per the Stack Overflow Perl FAQ: What's the easiest way to install a missing Perl module?
ppm install MinGW
cpanp i Win32::Exe PAR::Packer
In addition to the above answers,
You can use cpan to install the PAR::Packer.
From your windows command prompt use the command: cpan install PAR::Packer.
Note: I have Strawberry perl installed.
cpan installs the modules and the dependencies as well.

How can I run a Perl script with ActivePerl?

I just recently installed ActivePerl 5.12.2.1202 on my Windows XP in C:/Perl. I am new to Perl scripting.
I just want to run a Perl program which contains one print statement, which I saved in Notepad with the name ex.pl.
How can I run this Perl program?
Can I use an editor for typing a Perl script other than Notepad?
How do I use ActivePerl?
Run Perl program from command prompt
start->run>cmd (command prompt will appear), write perl full_path_of_your_script,
like
C:\> perl hello.pl #This assumes that perl is in your PATH environment variable.
There are many Perl Editors, you can
used for Perl scripts like DzSoft,
Perl Expess, Komodo Edit etc and also see http://www.perlmonks.org/?node_id=169668 and Perlfaq3- Windows Perl Editors for more detail.
Have a look at http://docs.activestate.com/activeperl/5.12/, for ActivePerl 5.12 documentation.
Perl programs (or any other program run by an interpreter) is run by passing the script as a command-line argument to the interpreter. For example, in this case:
perl.exe ex.pl
Padre the Perl IDE and Kephra are good editors for Perl.
As an alternative to ActivePerl, there is Strawberry Perl.
Perl programs are run using the Perl interpreter, perl.exe.
This is normally done from the command line:
C:\>C:\Perl\bin\perl ex.pl
If perl.exe is in your PATH environment variable that can be shortened to:
C:\>perl ex.pl
If you opted to have *.pl files associated with Perl during installation, you can also double-click on them from Windows Explorer.
If you have *.pl files associated with Perl and add .PL to your PATHEXT environment variable you can run them like any other executable:
C:\>ex
Perl programs are just text files. They can be edited with any text editor (Padre, Kokomo, vim, emacs, Notepad++, etc.). Use whichever one you like best.
ActivePerl is just a distribution of Perl. "Using" it usually means running perl.exe to execute your program. ActivePerl also includes the PPM (Perl Package Manager) utility to make it easier to install modules from CPAN, particularly if you don't have a C compiler available. Most experienced Perl developers prefer to use the cpan shell.
Just to add to the other answers, I use EPIC, the Perl eclipse plugin. I'm using Perl on a Windows 7 64 bit machine.
I still run scripts off the command line in windows using ActivePerl, but for development I like being able to dynamically step through the script line by line.
just to not paraphrase other answers and to be more helpful (even if the post is somehow old ) i recommend using the switch "-e" to run Perl scripts if they are composed of few statements e.g
Perl -e "print('hello')"
and of course this requires that the Perl executable is in the Path variable,if not and assuming Perl is under the folder c:\Perl , you can add it by taping :
set %PATH%=%PATH%;c:\Perl\bin
when it comes to the choice of text editor ,I'm still using Notepad++ for almost everything ,it come with some useful features like keywords highlighting and some auto-completion capabilities.

How can I make Eclipse work with `perlbrew`?

I'm using perlbrew to switch between perl versions. I also use Eclipse to write perl scripts.
It seems that Eclipse does not recognize the switches between perl versions, and keeps working with the base version installed out of perlbrew. I tried restarting Eclipse but this doen't help.
So, How can I make Eclipse work with perlbrew?
If you are using EPIC, this will work: Click through to Window->Preferences->Perl EPIC and set the Perl executable to perl5/perlbrew/bin/perl. This always points to the current set version of perl. The path is relative to your $HOME on Linux.
I haven't tried this as I usually just use a text editor for Perl, but I have taken to using the shebang line #!/usr/bin/env perl so that I get the perl for the user that runs the script (ie. perlbrew if me, system perl if root). If Eclipse executes the script (./myscript.pl) this should work, if instead it callsperl myscript.pl` then this will not help you.