Launching PERL

Help with setting up and configuring custom user tools in UltraEdit (based on command line input)

Launching PERL

Postby jfrailey » Mon Jul 11, 2005 2:58 pm

How can I configure UE to launch PERL?

Thank you

Jim
jfrailey
 

Re: Launching PERL

Postby ASTTMan » Tue Jul 12, 2005 7:43 am

First, create a tool under Advanced | Tool Configuration. On the dialogue, enter the following:

Command Line: %N%E
Working Directory: %P
Menu Item Name: Run Perl Script
Check "Save Active File" and "Capture Output". Select "Output to List Box".

Be sure to hit the Insert button to insert your selections into the tool list.

Second, create a macro to invoke your tool. Create a new macro as follows:

Code: Select all
InsertMode
ColumnModeOff
HexOff
UnixReOn
RunTool "Run Perl Script"

I assigned the macro to F12, but you could choose any key.

Assuming the perl installation directory is in your path, and you start your scripts with the line "#! /usr/bin/perl", it should work. (Note: I believe the only significant elements in that line are the "#!" and a path that ends in "perl". My actual directory in my path is "C:\Perl\bin", but this works for me!)

The output of the script goes to the Output Window, and if you get an error with a line number, you can double click on it to get UE to put you at that line.

Good Luck!
Dave
User avatar
ASTTMan
Basic User
Basic User
 
Posts: 26
Joined: Fri Feb 18, 2005 12:00 am
Location: Arlington, TX

Re: Launching PERL

Postby mjcarman » Thu Jul 14, 2005 10:08 am

A few comments from another perspective:

I use perl "%f" as my command line and don't rely on the shell to recognize the file type.

I normally have "Show DOS Box" selected. It's a little annoying at times, but it makes it much easier to kill the process if I borked something up in my script. Depending on what you're doing you may find "Replace Existing" preferable to "Output to List Box".

I have another tool called "Perl Lint" with the command line perl -Mstrict -Mdiagnostics -cw "%f". Very handy.

You can also launch the debugger with perl -d "%f". Make sure you have "Show DOS Box" selected for that one!

FYI -- you don't have to use a macro to launch user tools. I just use Ctrl-Shift-<#>.
User avatar
mjcarman
Power User
Power User
 
Posts: 122
Joined: Thu Feb 10, 2005 12:00 am

Re: Launching PERL

Postby jfrailey » Sun Jul 17, 2005 1:41 pm

Awesome and thank you!

Jim
jfrailey
 

Re: Launching PERL

Postby rags158 » Tue Jun 12, 2012 4:54 pm

Hi everyone!
I just downloaded the free trial of UEStudio and at the mo its pretty cool until I try and run the code (compile) it comes up with "no compile tool is associated with the file extension" tried the Help thingy trying to add a new compiler but still can not get it to work. I have all the perl stuff installed as I was using Padre and Komodo without any problems. Can anyone help please as this UEStudio seems exactly what I want and if I can get perl scripts to run in the output window then I will be buying it after the trial.

Thanks in advance.
rags158
Newbie
 
Posts: 1
Joined: Tue Jun 12, 2012 3:56 pm

Re: Launching PERL

Postby rhapdog » Tue Jun 12, 2012 6:58 pm

Perl is an interpreted language, so there's no actual compiling. From a DOS command line, if the perl executable is in your path, you'd type:
Code: Select all
perl "path\to\script.pl"
and your script will run.

It's easy to set up a user Tool for this.

Using the menu system in UEStudio (or even UE), do:
Advanced->Tool Configuration
perltool.png
perltool.png (15.46 KiB) Viewed 379 times

Under Menu item name you can type "Run Perl Script".
In the command line, give the full path to the perl executable, followed by a single space, then "%f" (be sure to place %f inside double quotes.) You can leave Working directory and Toolbar bitmap/icon empty if you like.

On the Options tab, Select DOS program, and check Save active file.
On the Output tab, check Capture output and select "Output to list box."
Replace selected text with: "No replace"

There you have it. If this is one of the first 10 user tools you have defined, then you can use a hotkey to activate it. Ctrl-Shift-0 through Ctrl-Shift-9. They will be listed at the bottom of the Advanced menu item.

Of course, you have to have perl installed on your system in order to do this. I use XAMPP for my development, and it comes with perl, so I was able to easily point to "C:\XAMPP\perl\bin\perl.exe" as the executable.
User avatar
rhapdog
Master
Master
 
Posts: 253
Joined: Tue Apr 01, 2008 10:02 am
Location: Mississippi, USA


Return to Custom User Tools/Tool Configuration