P is for Practical | |
PerlMonks |
Re^3: POE and Win32::Process controlby BrowserUk (Patriarch) |
on Feb 13, 2005 at 21:22 UTC ( [id://430637]=note: print w/replies, xml ) | Need Help?? |
That's a complex entity, rather beyond the scope of a "quick example". There are also some ambiguities in your description. If processing is already done, they simply receive the output. If processing is not done, yet, they see the same (following) output of the process. What if a read request is received for a process that has already started and produced half it's output? Does the new listener get everything that has already been sent to the file and any other listeners, or just that output the process produces after the request is received? Anyway, here's how to use a thread to spawn a command and 'tee' it's output to a file, and retain a copy in memmory for your main thread to process at it convenience whilst also getting on with anything else it needs to do (like communicating with clients and monitoring queues):
Whether that would work in conjunction with POE I'm not sure. Personally, I would write the whole thing using threads, but that's rather more than your OP asked for, and would take a fair amount of effort. Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.
In Section
Seekers of Perl Wisdom
|
|