X-Git-Url: https://git.sesse.net/?p=remoteglot;a=blobdiff_plain;f=varnishcount.pl;h=7411b054c0a1d010b790794fb1a569f8fc8d19b1;hp=1aa0e6f8f487659940355e95f96e9ec0a0b7df4d;hb=db1776a8d7db13906232041e019df8e292f29b08;hpb=7341e76ca62acf3b1d33a3d12cd4aefd1471fec9 diff --git a/varnishcount.pl b/varnishcount.pl index 1aa0e6f..7411b05 100755 --- a/varnishcount.pl +++ b/varnishcount.pl @@ -12,13 +12,17 @@ open my $fh, "-|", "varnishncsa -F '%{%s}t %U %q tffb=%{Varnish:time_firstbyte}x or die "varnishncsa: $!"; my %uniques = (); -my $ev = AnyEvent->io( +my $ev = AnyEvent::Handle->new( fh => $fh, - poll => 'r', - cb => sub { - chomp (my $input = <$fh>); - handle_line($input); - } + on_read => sub { + my ($hdl) = @_; + $hdl->push_read( + line => sub { + my ($hdl, $line, $eof) = @_; + handle_line($line); + } + ); + }, ); my $ev2 = AnyEvent->timer( interval => 1.0,