[Chicago-talk] trouble caputuring return value
Ted Zlatanov
tzz at lifelogs.com
Wed Mar 31 10:03:17 PDT 2010
On Wed, 31 Mar 2010 16:13:27 +0300 Shlomi Fish <shlomif at iglu.org.il> wrote:
SF> You should not expect Perl to assign to a variable in the main program by
SF> evaluating an assignment to its name in a different process. To communicate
SF> with a child process you need inter-process communications, such as anonymous
SF> pipes, sockets, named pipes, System V IPC, mmap, using the file-system for
SF> that, etc. Please read a little about UNIX multi-processing basics (a lot of
SF> which is also relevant to Windows and other operating systems).
...
SF> You cannot use return to return an arbitrary Perl value from a program. It
SF> only works for functions. As far as C and UNIX are concerned, everything that
SF> comes out of a process must be in sequences of octets. You need to use
SF> "print()" on something to emit it to the outside somehow.
If shared memory is a possibility, Tie::ShareLite makes it *really* easy
to share information persistently between programs.
Richard could also look into wxWidgets, which would make the input
reader better and wouldn't depend on gnome-terminal. If he explains
more about why he's splitting the task into a reader and a processor,
I'm sure he'd get more specific suggestions.
Ted
More information about the Chicago-talk
mailing list