From b4e8278ff42134addb4253bae92a198790bfaa7f Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 4 Feb 2010 16:47:30 -0500 Subject: [PATCH] REPL: Just stop interacting instead of dying after read errors. --- perl/lib/Net/REPL/Base.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/perl/lib/Net/REPL/Base.pm b/perl/lib/Net/REPL/Base.pm index 6e90296..3579735 100644 --- a/perl/lib/Net/REPL/Base.pm +++ b/perl/lib/Net/REPL/Base.pm @@ -36,22 +36,22 @@ incomplete. sub lv_receive { my ($self) = @_; - my $total_length = unpack('N', $self->_read_or_die(4)); + my $total_length = unpack('N', $self->_read_fh(4)); if (not defined($total_length)) { return; } # $self->debug('Incoming message:', $total_length); - my $message = $self->_read_or_die($total_length); + my $message = $self->_read_fh($total_length); return unpack('a*', $message); } -sub _read_or_die { +sub _read_fh { my ($self, $length) = @_; my $data; my $result = sysread($self->{'fh'}, $data, $length); if (not defined($result)) { - die("REPL PID $$: $!"); + $self->debug("REPL PID $$ reading: $!") } return $data; -- 2.11.4.GIT