Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: UNIX environment setup via perl

by haoess (Curate)
on May 07, 2004 at 14:39 UTC ( #351469=note: print w/ replies, xml ) Need Help??

in reply to UNIX environment setup via perl

Yes, your child processes can't put their environment to their parents. What about

$ENV{JAVA_HOME} = '/your/path';

-- Frank

Comment on Re: UNIX environment setup via perl
Download Code
Replies are listed 'Best First'.
Re: Re: UNIX environment setup via perl
by perlisfun (Sexton) on May 07, 2004 at 14:49 UTC

    This is not what we want. We actually want that environment variable is set after perl script is done/finished.
      This is not possible. Child processes cannot change the environment of its parents. In this case, the perl script cannot alter the environment in the calling shell. You have to use "source" or "." with a shell script instead. Another way is to use the shell-builtin "eval" to evaluate the output of the script. Look at /usr/X11R6/bin/resize for an idea how to use this.

      You can't manipulate environment variables for your parent processes. Why? It's a security concern.

      But: Your shell can use the output of your perl programm to set it's own environment:

      # perl -lw print "export FOO=bar"; # assuming bourne-compatible shell

      Later in your (parent) shell:

      $ eval `` $ echo $FOO bar $

      -- Frank

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://351469]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2015-11-28 23:43 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (746 votes), past polls