Via a pipe would be an obvious choice. Practically any means of transferring data from the child to the parent could be used to transmit environment variables.
| [reply] |
This looks like an XY Problem.
Give us some context of the real problem you are trying to solve and what alternatives you have considered.
| [reply] |
When you are running on an OS that has/supports the proc filesystem, you could read /proc/$pid/environ, but I'm not sure if that is (always) updated if the environment changes for the (sub)process, or that it just reflects the environment at startup. YMMV.
Enjoy, Have FUN! H.Merijn
| [reply] [d/l] |
Only using an IPC mechanism, see perlipc. The environment block in the child is only a copy of that in the parent. Well usually it is a copy, actually the parent can supply a totally different block for the child (on UNIX and Windows). | [reply] |
I guess it is not possible.. But does somebody knows a way of getting the values of environment from a child process to a parent process ?
Do you perhaps mean "Set environment variables within the parent (shell) process from a child (perl) process?"
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
Setting environment in child (perl )process, and getting it in parent ( perl ) process.
Forking a child perl process from parent perl process.
| [reply] |
Setting environment in child (perl )process, and getting it in parent ( perl ) process. Forking a child perl process from parent perl process.
You are suggesting using environment vars as an IPC mechanism?
If so, I don't believe that is possible on any multi-tasking OS.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |