|Come for the quick hacks, stay for the epiphanies.|
Inter-Process Communicationby Nitrox (Chaplain)
|on Jul 20, 2002 at 23:45 UTC||Need Help??|
Nitrox has asked for the wisdom of the Perl Monks concerning the following question:
This turned into a long discussion in the Chatterbox so SoPW seemed like the next logical step in my pursuit for enlightenment.
I've written a Perl program that sits in a while() loop doing a few tasks, one of which is polling the serial port for data. When data is received the program does some control calls to a win32 application via OLE.
Now I'm looking for a way to pass data(a simple string) back to my Perl program. Any ideas?
One of the issues is that the solution needs to be "non-blocking" since my program needs to continue polling the serial port and lives in a single threaded world.
The win32 app has the ability to run PerlScript via the ActiveX engine, so one solution I thought might work would be to spawn a thread in my Perl app that opened a tcp socket and listened. The win32 app would then run a PerlScript that connected to the socket and passed the string. In turn, the child would then pass the string to the parent. Unfortunately I do not see a way to get the child thread to communicate with the parent.
So, what is the best solution to pass data to a running Perl process in the Win32 environment?