On Wed, Sep 30, 2009 at 4:48 PM, Alexander Indenbaum <[email protected]> wrote: > Hello, > > I have bash script which alters environment, kind of configuration, > let's say config.env. > > I'd like to import this environment in context of perl script. How do > I do equivalent to 'source config.env' from perl code? I mean I could > just run bash in subprocess, but it would not alter perl process > environment. > > Any thoughts?
My first thought is to create a wrapper bash script that will source config.env and call the perl script (or an arbitrary command specified as the tail of the command line, if you wish) in case of success. I am not an expert in perl but I suspect you can then call the wrapper script using system()/exec()/friends from other perl code. "There is no problem in computer science that cannot be solved with another layer of indirection." Who said that? ;-) Once again, I am not a perl expert, but AFAIK perl does some checking on some parts of the environment (PATH, CDPATH, IFS, ENV, BASH_ENV, etc.) for security reasons, so you should make sure that your config.env does not make perl suspicious. -- Oleg Goldshmidt | [email protected] _______________________________________________ Linux-il mailing list [email protected] http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
