Just a quick update on my project. I am still reading up on AnyEvent, IO::Async, POE etc., and apart from making my brain hurt, I've come to the conclusion that these options are far more complicated than I want / need.
I'm now leaning towards Chris' advice. The solution that I'm probably going to use is to have a simple File::Tail reader monitor the log file from the Domoticz. This solution seems to be the most reliable File::Tail solution as it seems to handle log rotations etc. better than the rest. I haven't managed to get a *reliable* File::Read working any other way, and as this is going to be a 24/7 service I need it to be reliable. All of the actual tasks are now going to be handled by seperate perl scripts, which means I can simply tidy up and utilise existing proof-of-concept scripts that I've already started collecting together (e.g. LED blinker) Just as an aside, when did this list get so quiet? I can't believe how few posts there have been since my OP On Wednesday 23 November 2016 23:55:36 Chris Fedde wrote: > It might not be too bad an idea to just use processes rather than getting > wrapped up in event loops and asynch IO. > Forking is cheap and fast in linux. In my opinion it gets overlooked for > many cases where it is a perfectly acceptable approach. > > There are lots of approaches to work queues. The main architectural > approach is how close the coupling needs to be between the requester and > the worker. > One of my favorite, simple approaches is to put files into a directory. > Each file represents a tasks and perhaps contains interesting metadata. > > chris > > On Wed, Nov 23, 2016 at 7:36 AM, Gary Stainburn < > > gary.stainb...@ringways.co.uk> wrote: > > On Wednesday 23 November 2016 14:05:40 Shlomi Fish wrote: > > > Aside from named pipes there are also unix-domain sockets and TCP > > > > sockets, > > > > > both of which are more robust. > > > > The closest thing I've got to IPC is writing an xinetd service, which I > > then > > called from perl scripts using Net::Telnet. IPC is therefore one of the > > things I'm going to have to learn. The Domoticz service that I'm > > supporting > > is itself an event driven service which runs pretty much all of my house. > > The key requirement of whatever method I use is that I cannot under any > > circumstance block Domoticz. That is one reason I'm wary of using a > > pipe.. If my server dies, then writing to the pipe will block. The > > benefit of a pipe > > is that it's very simple to code in however many ways I need, Perl, LUA > > etc. > > (LUA is embedded in Domoticz) > > > > I have considered using a standard text file rather than a pipe, allowing > > anything to append to the pipe, then my daemon reading when it's ready. > > One > > things I have found to help with this is: > > > > https://gist.github.com/sugar84/1198879 > > > > which is an example of tail -f to a pipe. As Domoticz already writes to > > a log > > file, I should be able to readm input from there too and respond to both > > (hopefully) > > > > > Last time I checked, AnyEvent erred if IO-Async which is a different > > > alternative was also used, causing some people to avoid using AnyEvent. > > > I ended up sticking with AnyEvent for > > > https://metacpan.org/release/App-ManiacDownloader because IO-Async's > > > support for FTP was lacking. > > > > Are you saying that the problem only arrises if I use both AnyEvent and > > IO-Async? I haven't had a look at the latter, but I doubt (hope) that my > > daemon won't get too complicated. > > > > > Also see the page I wrote here - http://perl-begin.org/uses/ > > > > multitasking/ . > > > > > There's also https://metacpan.org/release/Reflex which I think is a > > > Moose-based rethinking of POE . > > > > Thanks for the extra links. I'll have a good look at them all before > > starting. > > > > Gary > > > > -- > > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > > For additional commands, e-mail: beginners-h...@perl.org > > http://learn.perl.org/ -- Gary Stainburn Group I.T. Manager Ringways Garages http://www.ringways.co.uk -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/