in reply to Changing STDIN to tty

Hi perl_lover,

Now that you have an answer, I'm going to jump into your question and add my own: Does anybody know how to do this portably? In particular, something that will work on both Windows and Unix.

Thanks!

Replies are listed 'Best First'.
Re^2: Changing STDIN to tty
by shmem (Chancellor) on Aug 31, 2006 at 15:32 UTC
    Probably reading open is all that is needed :-)

    There's a snippet of code which shows how to dup, redirect and restore STDOUT and STDERR. Should be working for STDIN and with Windows also.

    Could you check? I don't do/have Windows.

    <update> PS: there might be a package on CPAN... :P </update>

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      Hi shmem,

      Right, I know how to manipulate the filehandles with open, what I don't know is a portable way of saying /dev/tty.

      Thanks!