For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > December 2007 > Env variables readable by an application









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Env variables readable by an application
Travis Thornhill

2007-12-28, 4:01 am

I have an application that executes a user-defined script. The application sets certain environment variables that the script uses to determine which phase it is in.

I want to be able to set other env variables to set other conditions usable by the script.

Is there a way to do this? In other words, is there a way to set env variables that ANY user and ANY application can see?

Thanks in advance,
- Travis.


---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
Chas. Owens

2007-12-28, 4:01 am

On Dec 28, 2007 2:24 AM, Travis Thornhill <madslashers2002@yahoo.com> wrote:
snip
> Is there a way to do this? In other words, is there a way to
> set env variables that ANY user and ANY application can see?

snip

No, environmental variables are a per-process thing. Child processes
inherit the state of their parent's environment, but that is it. If
you need inter-process communication you have to use IPC*, a file, a
database, or some other external resource. Take a look at
IPC::SharedCache** or one of the other IPC modules*** on CPAN.
Depending on your needs a simple file might suffice though.

* that is what it stands for after all.
** http://search.cpan.org/dist/IPC-Sha.../SharedCache.pm
*** http://search.cpan.org/search?query=IPC
Travis Thornhill

2007-12-28, 4:01 am



"Chas. Owens" <chas.owens@gmail.com> wrote:
No, environmental variables are a per-process thing. Child processes
inherit the state of their parent's environment, but that is it. If
you need inter-process communication you have to use IPC*, a file, a
database, or some other external resource. Take a look at
IPC::SharedCache** or one of the other IPC modules*** on CPAN.
Depending on your needs a simple file might suffice though.

Unfortunately you're right. I waded through perldocs and found that there is no way I can set env variables that other processes can access. But using a file will actually be easier. Thanks for the assistance.

- Travis.



---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com