Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Setting environment-variables in Eclipse (EPIC)? [SOLVED]

by sundialsvc4 (Abbot)
on Mar 15, 2011 at 22:20 UTC ( #893451=perlquestion: print w/replies, xml ) Need Help??
sundialsvc4 has asked for the wisdom of the Perl Monks concerning the following question:

Now here’s a weird one for ya ...   (Environment:   OS/X Snow Leopard)

I’ve got a legacy Perl application which, in a BEGIN block, looks for a particular environment-variable.   Therefore, a statement like use name_of_this_module; won’t succeed unless the environment variable exists.

And this prevents something that is “nice to have,” namely, Eclipse’s syntax-checking.   That is, unless I can figure out a(n easy) way to define an environment variable either within Eclipse, or when Eclipse launches.

I have already put the appropriate export statements in the .profile shell-script...

This is, as I said, just a “nice to have,” but I idly wonder if it could easily be done ... y’know, without defining a shell-script to launch Eclipse.   (Or, is that “The Way?”)

Edit:   “Just Google It™” ...
Fortunately, I caught myself before pressing “Post” ...   But now, having found the problem (and having solved it), maybe someone else wants to know, too.   Here are some directly relevant web-pages that actually address this problem, thoroughly and completely:

Perhaps this “discovery” will be useful.   (Note that you must install Apple's (free) “Developer Tools” in order to get the PList editor, although the format is “just XML ...”)

Now You Know.™

  • Comment on Setting environment-variables in Eclipse (EPIC)? [SOLVED]

Replies are listed 'Best First'.
Re: Setting environment-variables in Eclipse (EPIC)?
by ikegami (Pope) on Mar 15, 2011 at 22:39 UTC

    If the variable in question is PERL5LIB, you can also add paths by right-clicking the project, choosing Perl Include Path, and adding ${project_loc}/lib or whatever.

    I have already put the appropriate export statements in the .profile shell-script...

    Then one would conclude that .profile isn't getting executed. Perhaps you are using a GUI? For KDE, I created the following shortcut:

    $ dir .kde/env/ total 0 lrwxrwxrwx 1 eric users 24 Jan 20 2009 -> /home/eric/.bash +_profile $ cat .bash_profile ... export PATH=~/usr/perlbrew/bin:~/usr/perlbrew/perls/current/bin:$PATH export PERLBREW_ROOT=~/usr/perlbrew ...

    Surely there's something similar for OS/X.

    This way, you can solve the problem for all applications, not just Eclipse.

      Thank you for your suggestions, but let me clarify a couple of points:

      1. The problem isn’t PERL5LIB, but environment variables.   (EPIC does have a well-defined and workable way to specify the Perl include-path .. @INC ... to use for a particular project.)
      2. The behavior that is adversely affected by the lack of environment variables is simply the built-in syntax checking (red “X” in the margin to the left of a line, indicating an error was found there).
      3. You can set the environment-variables that are associated with a GUI icon in OS/X, as detailed in the Apple technical article (third bullet point in the OP).

      What I would “like to have” is the ability to specify environment variable settings, as well as the @INC path, on a per-project basis.   However, in any case, the impact to me is negligible, and the code in question is definitely “the odd man out.”

Re: Setting environment-variables in Eclipse (EPIC)? [SOLVED]
by Aaronrp (Beadle) on Mar 16, 2011 at 00:57 UTC

    What I do in Eclipse/EPIC is change the perl executable line.

    /ActivePerl/bin/perl -I/Users/apriven/Dev/Source/Actium/trunk -MActium::Eclipse

    (Actium is the name of my project)

    Then, whatever I want to do in Eclipse, but not when running otherwise, is done in the Actium::Eclipse module.

    Here's my Actium::Eclipse module:

    -- Am I the only one who still cares about RT #67694?

      I am going to have to “munch on” what you have just said here, for quite some time.   I confess that I do not fully understand it now.   (But, “if Perl hath many mysteries, forsooth, Eclipse hath many more.”)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://893451]
Approved by ikegami
Front-paged by ikegami
[Discipulus]: too much guns in schools? throw more gun at schools! professors in arms
LanX thinks teachers nowadays need every possible mean to defend against their annoying students.

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2018-02-23 11:35 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (302 votes). Check out past polls.