in reply to Re^2: IO::Socket recv and send
in thread IO::Socket recv and send
Error checking code often adds a bunch of visual clutter to code. It's all a matter of which tradeoffs you want to make.
Checking before each send()/recv() is pretty good, but (as you mention) adds clutter. Worse, it won't always work, as you could be disconnected between the check and the following call.
You could also check only after you receive a null, but only works for recv().
You mention that in C you could check for SIGPIPE, so if it meets your needs in C, why not use it in your script? The perlvar documentation for %SIG shows how to create a signal handler.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|