in reply to howto redirect STDOUT to $socket
Note that the "local *STDOUT;" would prevent the proper use of '>&' from making file descriptor (fileno) 1 redirected to the socket. And that would mean that C code (such as module XS code) or external code (such as run via exec or system) would not write to the socket when it wrote to its STDERR equivalent.
So it is better to use the sample code from open for saving and then restoring STDOUT instead of using the seductively simple "local *STDOUT;". I'll also note that manipulating symbol-table globs that contain open file handles will often have even worse results so I consider it something one should avoid unless one clearly understands exactly why it should be avoided.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |