In the last article we imagined a dashboard that could display measurements coming from a machine, but the article felt quite short to that promise. But beauty is in the eye of the beholder.
Imagine an industrial machine emitting measurements and data as MQTT messages. These messages are then processed in a web server and pushed into a web page using Server-Sent Events to be displayed in a nice dashboard. Well, this posts merely scratches the surface of this application.
This article demonstrates a program which launches an external process, waits for it to exit, waits a certain time, and restarts the cycle again. It is built using an AnyEvent child watcher and a timer.
Some time ago, a user of Device::Modbus told me that it would be nice if the server was implemented using AnyEvent rather than Net::Server. So, this is a first attempt at bending my head over AnyEvent servers.