in reply to (bbfu) Re: Remote interpreter (redefining print())
in thread Remote interpreter (redefining print())

You need to use the file descriptor, not the file itself:
$fd = fileno($fh); open STDOUT, ">&$fd"
Yes, this works for sockets. The typeglob assign just needs another star:
local *STDOUT = *$fh;

Replies are listed 'Best First'.
(bbfu) (dup-open) Re(3): Remote interpreter (redefining print())
by bbfu (Curate) on May 08, 2001 at 01:56 UTC

    You need to use the file descriptor, not the file itself:

    Right, that's it. :-) I'm used to duping regular typeglob-style filehandles, in which case you can just use the name. But you're right that you need the fd for anonymous symbol-table entries (a la FileHandle).

    The typeglob assign just needs another star:

    Cool. I knew there was a way to do that but couldn't think what it needed. Good catch.

    bbfu
    Seasons don't fear The Reaper.
    Nor do the wind, the sun, and the rain.
    We can be like they are.