As a simple flag, a file may work but I'm not crazy about that one. If someone else touches it they affect the process ... Files, in general, make poor IPC choices. For a simple flag, pick a semaphore model. Depends on your platform which one fits -- I'm only familiar with the UNIX System V semapahores but have not used them from Perl. A signal can be used as a semaphore, but that also keeps me awake at night. It's asynchronous which means that anything called from the handler has to be reentrant. You can sometimes get away with setting a global flag and checking it in your main loop in a pinch though. Again, I have not done any of that in Perl so just ideas ...
| [reply] |
I'm not sure what your statement about files making a poor IPC choice is based on. I consider the ability to stop the process by touching the file a feature.
Files are simple and portable, and don't require a lot of extra modules to be compiled. This monk stated he is on Windows, so his options are limited, especially if he cares about being cross-platform.
| [reply] |
| [reply] |