Tapatalk

Launching PERL

Launching PERL

jfrailey

    Jul 11, 2005#1

    How can I configure UE to launch PERL?

    Thank you

    Jim

    261
    Basic UserBasic User
    261

      Jul 12, 2005#2

      First, create a tool under Advanced | Tool Configuration. On the dialog, 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, assign a hotkey at Advanced - Configuration - Key Mapping to appropriate command AdvancedUserToolx to quickly invoke the Perl script via the user tool.

      Alternatively you could create also the macro

      Code: Select all

      RunTool "Run Perl Script"
      and assign a hotkey to this macro. I assigned the macro to F12, but you could choose any key. The macro must be saved into a macro file (with other macros) which is configured to be automatically loaded on startup. The advantage of using a macro to run the user tool via hotkey is that the user tools can be re-ordered without the need to re-order also the hotkey assignments in the key mapping configuration dialog.

      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 and a path that ends in

      119
      Power UserPower User
      119

        Jul 14, 2005#3

        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-<#>.

        jfrailey
        jfrailey

          Jul 17, 2005#4

          Awesome and thank you!

          Jim

          1
          NewbieNewbie
          1

            Jun 12, 2012#5

            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.

            2362
            MasterMaster
            2362

              Jun 12, 2012#6

              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 (15.46KiB)

              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.

              1
              NewbieNewbie
              1

                Feb 12, 2013#7

                I was referred to this thread by Mofi, who replied to the thread I started which is already deleted. At Mofi's request, I am posting what I did here. I used the following Tool Configuration settings so that I could see the output of my perl script, including error and warning messages, in a command window, and pause the window so I can read the output before closing it manually (key press):

                Tool Configuration

                Command

                Code: Select all

                	Command Line: 
                		UEPerlTool.bat "%f"
                	Working Directory: 
                		%p
                
                Options

                Code: Select all

                	Dos Program
                
                Output

                Code: Select all

                	Command Output (DOS Commands)
                	Output to List Box
                	Show DOS Box
                	No Replace
                
                These are the only settings I checked off. All other ones are unchecked.

                UEPerlTool.bat:

                Code: Select all

                	@echo off
                	"Path\to\perl.exe" %*
                	echo.
                	pause
                
                Using the batch file was Mofi's suggestion. Note that you need to have the .bat file in your %path% or else include the full path in quotes on command line of the user tool.

                I created a macro as above with a shortcut key. It works well. One key combination saves having to <alt>-<tab> to a command window, <up-arrow>, <enter>, go back to UE. Nice.

                1
                NewbieNewbie
                1

                  Jan 21, 2014#8

                  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!)

                  119
                  Power UserPower User
                  119

                    Mar 31, 2014#9

                    abby741 wrote:Assuming the perl installation directory is in your path, and you start your scripts with the line "#! /usr/bin/perl", it should work.
                    The shebang (#!) line is processed by the shell on Unix/Linux systems. It is not recognized by Windows.