Question

I'm writing a daemon that interfaces with a USB device (an Arduino). This daemon is continuously aware of the current state.

Now I want to be able to interface with this daemon through a client program, also to be written in Perl. This client must be able to query the daemon for its current state and it must be able to update the daemon with settings.

I'm on Linux (x86_64)

I don't want to use an intermediate file and preferably simultaneous queries are easily implemented.

What is the name of such a mechanism? What Perl libraries can I use or should I avoid? What should I DuckDuckGo for?

Was it helpful?

Solution

Probably, you need to implement an event loop to allow doing the tasks of your USB device communication and serve information to the new interface. This concept will change the way you solved the problem, but I think is the better approach. You can search at CPAN for modules like POE and AnyEvent The idea is to build an event loop that handles a TCP socket in order to send & receive information from te interface

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top