http://www.perlmonks.org?node_id=809009


in reply to Prototype - Command line, controllable, media player

I've known various people who have implemented various systems like this. My main suggestion would be that instead of using named pipes, attempt to listen to a port. if you can, start the daemon; if you can't that means the daemon is already running and you should communicate with it (via that port).

This not only provides an easy way to deal with the "it died horribly and left the pipe file around" type problems (because if the process dies it won't be bound to the port anymore) but also allows you to do stuff like ... make HTTP your communication protocol. that way any HTTP client library can be used to talk to your server.