Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Called Programs and Environment Variables - "Scope" Question 1

Status
Not open for further replies.

jimlocigno

Programmer
Nov 20, 2000
14
US
Hi,

What I would like to do is have a perl program: Perl_A
and have Perl_A call another program (potentially in perl - maybe KSH) - let's call it: external_program.

Code:
So,

Perl_A
 ...code
 ...code
 qx!external_program!
 ...code
 ...code


The catch is that external_program will set Environment Varaibles and I want the Environment Variables that external_program set to be available in Perl_A.

From what I can tell this is not possible? Is that true?
From what I can tell any perl command that calls an external program does so in a different process then Perl_A?

Is there any way around this? Or am I missing someting obvious here?

Thanks
 
The catch is that external_program will set Environment Varaibles and I want the Environment Variables that external_program set to be available in Perl_A.

From what I can tell this is not possible? Is that true?
That's what I thought until a few weeks ago. I was very surprised to find that it is possible to do what you want.

Take a look at this thread: thread219-974317, in particular apostate's post near the bottom of the thread. I think this is just what you're looking for.

 
Mike,

Thanks very much for the information. From what I can tell this will work for what I need it for but can't be positive until I get our Unix admin to install that module. If this works they way it should, it will save me a LOT of headaches. I really want use perl for the utility I am writing and for a lot reasons I need to exchange environment variables back and forth. Thanks again.





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top