Sorry, completely missed your follow-up...

I'd say the synopsis of Mojo::IOLoop mostly shows what to do. Never tried 
it myself, but something along these lines should work:

use Mojo::IOLoop;


my $id = Mojo::IOLoop->client({ path => '/tmp/myapp.sock' } => sub {
  my ($loop, $err, $stream) = @_;
 
  $stream->on(read => sub {
    my ($stream, $bytes) = @_;
 
    # Process input
    say "Input: $bytes";
  });
});
 
# Start event loop if necessary
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;

There may be other ways to achieve what you want, but this seems the 
easiest solution to me.
Of course there's no guarantee that your "read" callback is called exactly 
once for one complete new syslog entry. You may receive only parts of one 
log entry or a whole bunch of log entries at once and you have to parse and 
split them yourself, sometimes waiting for the rest of an entry to bee 
provided in the next call of your callback...

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/5bd488c5-b97a-4140-9554-216805eca7c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to