in reply to syswrite, closed socket and error handling

You have to trap or 'IGNORE' SIGPIPE. SIGPIPE is thrown when you write to a broken pipe. Having never used Komodo before, I'm guessing it installs its own signal handlers or something?? If you do
$SIG{PIPE} = 'IGNORE';
at the top of your script it won't die/exit silently. or you could do
my $connected = 0; $SIG{PIPE} = sub { warn "Lost connection to server: $!"; $connected = +0; }; use IO::Socket::INET; use Carp; sub new_connection { return IO::Socket::INET->new( PeerAddr=> $host, PeerPort=> $port, Proto=> "tcp", Blocking => 1 ) ; } my $socket = new_connection() or die "$!"; my $output; for(1..100){ print $_ . ".."; sleep(2); if ($connected) { $output = $socket->syswrite($string); } else { $socket = new_connection (); or die "$!" $connected = 1; } print "done\n"; }
By no means optimal at all, but just to give you an idea.