Skip to content

Instantly share code, notes, and snippets.

@redneb
Created December 13, 2011 04:43
Show Gist options
  • Select an option

  • Save redneb/1470627 to your computer and use it in GitHub Desktop.

Select an option

Save redneb/1470627 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use EV;
use AnyEvent::Handle;
use AnyEvent::Socket;
my @remebered;
tcp_server 'unix/', '/tmp/stop_read_test', sub {
my ($client) = @_;
$client = AnyEvent::Handle->new(fh => $client);
push @remebered, $client;
$client->on_read(sub {
my ($client) = @_;
$client->{rbuf} = '';
print "read\n";
$client->stop_read;
});
};
EV::loop;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment