Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vti committed Apr 9, 2011
1 parent 57da1e1 commit 726cc24
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/Terminal/Handle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,24 @@ sub new {

$self->{handle} = AnyEvent::Handle->new(
fh => $self->{fh},
on_error => sub {
on_read => sub {
my $handle = shift;
my ($is_fatal, $message) = @_;

my $chunk = $handle->rbuf;
$handle->rbuf = '';

$self->{on_read}->($self, $chunk);
},
on_eof => sub {
my $handle = shift;

$self->{on_eof}->($self);
},
on_read => sub {
on_error => sub {
my $handle = shift;
my ($is_fatal, $message) = @_;

my $chunk = $handle->rbuf;
$handle->rbuf = '';

$self->{on_read}->($self, $chunk);
$self->{on_error}->($message);
}
);

Expand Down

0 comments on commit 726cc24

Please sign in to comment.