|Keep It Simple, Stupid|
Re^3: Global Variables Not Updated in Child Processby afoken (Prior)
|on Nov 21, 2012 at 18:13 UTC||Need Help??|
My Prime focus is not forking but process some thing in a child process and get the values updated in parent.
So you want your son to learn French and your daugther to learn German, and you expect that you automatically speak both French and German as soon as both have finished learning. Does that work in real life? Nope. And it also won't work with fork()ed processes.
Generally, processes can't update other processes data. You need some kind of inter-process communication, or shared memory. Shared memory won't work well with Perl, because perl tends to move data around when its size changes. See perlipc for details on both ways.
Another option, with its own set of traps, is using threads. Threads give you lightweight "processes" inside a single process, and threads can actually share variables. See perlthrtut for details. Of course, this works only if all external programs you are using now are merged into a single big program (possibly by moving each program into a single module).
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)