I've been doing some work with forking lately (see my posts if you want to know about perl/tk and forking and win32), and my initial thought after reading your question was to just open up pipes both ways (child to parent and parent to child) and then you can just have the child print a line back to the parent when it is done. Just format the line so it is easily split apart into the various parts of say a hash or array, etc.
For example you could print this back:
key1:element1,key2:element2 (and so on)
Then the only thing you have to figure out (from the IPC docs or wherever) is how to wait for this in a nice way in the parent (unless you don't mind polling...). The parent just has to split the line, and put it back together.
Admittedly, this is a hack. But sometimes its more fun to just get it working and move on to other cool parts of the program. ;)
Justin Eltoft
"If at all god's gaze upon us falls, its with a mischievous grin, look at him" -- Dave Matthews
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.