citromatik has asked for the wisdom of the Perl Monks concerning the following question:

Hi all

I'm trying to use EPIC (Perl perspective for Eclipse v3.4.1).

Does anybody know how to specify command line options when running a script within eclipse? I'm not able to do it following the official documentation (the "Arguments" tab under "Run configuration..." seems a bit cryptic to me).

Any help would be appreciated.

citromatik

  • Comment on Command line options in EPIC (Perl + Eclipse)

Replies are listed 'Best First'.
Re: Command line options in EPIC (Perl + Eclipse)
by ikegami (Patriarch) on Feb 24, 2009 at 17:17 UTC

    Here are the steps for the Debug configuration. Same idea for Run configuration.

    • Debug it once. This will create a default configuration for it.
    • Right-click on file in Project Explorer or Navigator
    • Click Debug As
    • Click Debug Configurations
    • Click Perl Local
    • Select the file (should already be done)
    • Click Arguments
    • Type in the arguments in Program arguments

    To set @INC to find your project's modules:

    • Right-click on the project in Project Explorer or Navigator
    • Click on Properties
    • Click on Perl Include Path
    • Click on "..."
    • Locate the base path of your modules
    • Click Add to List (will look something like ${resource_loc:/project/lib})
      Hello. Is there a way to set @INC for all your projects at the same time (ie a default @INC for all your projects in Eclipse) rather than doing each one seperately? Cheers.
Re: Command line options in EPIC (Perl + Eclipse)
by Bloodnok (Vicar) on Feb 24, 2009 at 16:38 UTC
    Not very encouraging I know, but I gave up (attempting to bend Eclipse/E-P-I-C to my will) after seeking the advice from the monastry...

    A user level that continues to overstate my experience :-))
      I've managed to get a shell interface on my Epic IDE, so that I can run perl code and check output without having to revert to a command line interface. You can pass an argument(s) to your code this was also. Btw, I'm using WinXP with ActivePerl installed. Here's how its done: 1. Run->External Tools->External Tools Configutations... 'Main' tab: *********** 2. 'Name' field -> enter 'myShell' 3. 'Arguments' field -> enter: /C "cd ${container_loc} && perl -w ${resource_name} ${input_var1}" (note, for a full breakdown of the above variables, check out the url 'http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.user/concepts/concepts-exttools.htm') 4. The above variable 'input_var1' is one I created and I'll explain that below 'Common' tab: ************* 5.In the 'Common' tab, ensure the following radio buttons/tick boxes are checked: - Local file - Default - inherited (Cp1252) - External Tools - Allocate Console (necessary for input) - Launch in background 'Main' tab: *********** 6. Below the 'Arguments' field, click 'Variables...' button 7. Edit Variables 8. New 9. Enter 'input_var1' in the 'Variable' column and a default value in the 'Value' column' 10. OK, OK.. 11. Click 'Apply' and 'Run', and this will pass the value held in 'input_var1' to your code (can process in the usual way by dereferencing @ARGV[]->$ARGV[0]) 12. When you want to alter value held in 'input_var1' and hence value passed into your code, do the following: 12a. Window->Preferences 12b. You're now in the 'String Substitution' facility, where you can happily edit and save changes to 'input_var1' Hope this helps :)
        Apologies guys, I'll make it more legible: I've managed to get a shell interface on my Epic IDE, so that I can run perl code and check output without having to revert to a command line interface. You can pass an argument(s) to your code this was also. Btw, I'm using WinXP with ActivePerl installed. Here's how its done: 1. Run->External Tools->External Tools Configutations... 'Main' tab: *********** 2. 'Name' field -> enter 'myShell' 3. 'Arguments' field -> enter: /C "cd ${container_loc} && perl -w ${resource_name} ${input_var1}" (note, for a full breakdown of the above variables, check out the url 'http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.user/concepts/concepts-exttools.htm') 4. The above variable 'input_var1' is one I created and I'll explain that below 'Common' tab: ************* 5.In the 'Common' tab, ensure the following radio buttons/tick boxes are checked: - Local file - Default - inherited (Cp1252) - External Tools - Allocate Console (necessary for input) - Launch in background 'Main' tab: *********** 6. Below the 'Arguments' field, click 'Variables...' button 7. Edit Variables 8. New 9. Enter 'input_var1' in the 'Variable' column and a default value in the 'Value' column' 10. OK, OK.. 11. Click 'Apply' and 'Run', and this will pass the value held in 'input_var1' to your code (can process in the usual way by dereferencing @ARGV[]->$ARGV[0]) 12. When you want to alter value held in 'input_var1' and hence value passed into your code, do the following: 12a. Window->Preferences 12b. You're now in the 'String Substitution' facility, where you can happily edit and save changes to 'input_var1' Hope this helps :)
Re: Command line options in EPIC (Perl + Eclipse)
by almut (Canon) on Feb 24, 2009 at 17:14 UTC

    The description ("3. If you wish to pass command-line parameters to the script or to the Perl interpreter, enter them in the Arguments tab.") doesn't sound too cryptic to me.  I don't have EPIC installed, but from the description I'd expect to see two textfields/-areas in the arguments tab... one for your script, and one for Perl itself.

    So, I'm wondering what happens with any arguments you enter there? Are they simply being ignored, or what?  Seems like basic functionality... if it in fact doesn't work, my inclination to spend more time with the tool would vastly decrease :)

      I don't have EPIC installed, but from the description I'd expect to see two textfields/-areas...

      Your expectations are quite right;-) One area to enter the command line arguments for your program, one area to enter the arguments for Perl. It works quite well and both on Windows and Linux. There are more advanced options and other tabs in this dialog box though.

      So, I'm wondering what happens with any arguments you enter there? Seems like basic functionality...

      It * is * basic functionality and it works as expected, i.e. the arguments are passed to Perl and the script respectively. It works fine in practice though frankly speaking there is no need to use this functionality. Both on Windows and Linux the command line is more flexible. The only advantage I can think of is that you don't have to switch to another Window if you work from Eclipse/EPIC. It does give some nice other features.