how to run Perl programs within Eclipse?

  • Felix Schwarz

    Felix Schwarz - 2003-05-23


    I want to start Perl scripts with F11 (as I do with Java Programs) but
    nothing happens. Is this function already implemented in the plugin?

    btw: Why aren't  the plugin files not stored on the official download
    servers? I'd like to monitor these files so I'll get a notification if
    there's a new version but this function is only enabled for officially
    released files...


    • Anonymous

      Anonymous - 2003-05-23

      This is how set up Eclipse to run the Perl scripts I'm editing:

      1. Go to Run | External Tools | External Tools...
      2. Under Configurations, click on Program, then click New
      3. Type in a Name (e.g., Perl Script)
      4. On the Main tab enter the following information: Location (e.g., C:\Perl\bin\perl.exe), working directory (e.g., C:\Program Files\Eclispe\workspace), and Arguments (e.g., -w ${resource_loc}).
      5. On the Common tab, choose Perl as the Run mode, then click External Tools to Display in favorites menu.
      6. Choose Apply, then Close

      To run a script I'm editing, I simply click on External Tools icon. It's not the same as pressing F11, but it's quick nonetheless.

    • Anonymous

      Anonymous - 2003-11-19

      If your running Eclipse on Linux you might want to try:

      under Run->external tools->external tools->
      on left select Program.  Click New.  Rename to whatever at top.
      Location: /usr/bin/perl (your perl executable)
      Working Directory: $HOME/eclipse/workspace (or wherever Eclipse's
      workspace directory is)
      Arguments:  Click on Variables and select ${resource_loc}.
      Uncheck Run tool in background if you want.
      Click the Common tab.  Check External Tools check box under "Display in
      favorites menu:"
      Click Apply. Click Close. Select perl script to run.
      From Run->external tools Select whatever you named the Program.
      Output window will appear at bottom after run.

    • The Beginner

      The Beginner - 2005-06-20


      My inputted text

      Through Eclipse and the output in the console view:

      My inputted text

      Why are the prints only fushed in the console view at the termination of the program in the Eclipse environment why not as in real?
      Are ther afeature i have missed to get things right?

    • The Beginner

      The Beginner - 2005-06-20

      Forgot to add the test script.

      print $hej . "\n";
      print "$ss\n$hej\n";

      • mathieu

        mathieu - 2005-06-20

        Something to do with output buffering.

        When perl is run in a console, it autoflushes STDOUT, but if it thinks its redirected to a file, it doesn't. This makes for better performance, but messes up IDEs.

        You could put "$| = 1;" (without the quotes) at the start of your script, that would force autoflush, regardless of whether you're running in the console or not.

        Another thing to note is that STDERR and STDOUT outputs seem out of order when used in an IDEs. I have had weird result with that even with autoflush turned on.


    • The Beginner

      The Beginner - 2005-06-20

      Thanks a lot, you are todays hero.
      Rapid answer and relevant.
      /The Beginner


Log in to post a comment.