in reply to export environment variable from a perl program
Doesn't really have anything to do with perl, but with the process model most operating systems, if not all, use. That is, a child cannot affect its parent, only vice versa.
What I've done is create a "mkAlias" perl script which sets up my environment by printing shell commands to STDOUT. I then evaluate it in shell as:
Note that the shell pretty much removes all carriage-returns in the output (not quite true, but close enough), so separate each command from perl with a semicolon:eval `mkAliases`
Hopefully you're using a shell that can do this - if you're using CMD.EXE on Windows, sorry, but the only solution is to have perl run CMD.EXE for you.print qq[export VAR1="text";\n];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: export environment variable from a perl program
by Fletch (Bishop) on Feb 02, 2005 at 15:44 UTC |