On Mon, Nov 15, 2004 at 08:40:00PM +0200, Gabor Szabo wrote:
> I have a script using Term::ReadLine to get input.
> I'd like to test it by executing it using another script
> and providing answers from the script test script.
> I tried IPC::Run with no success but as I notice even simple redirection
> such as
> 
>     input.pl < in.txt
> 
> does not work.
> Any ideas how to automatically test such a script ?

Term::ReadLine does not read from STDIN but from a TTY.  IPC::Run explains

       o   Refusing to accept input unless stdin is a tty.

           Some programs, for security reasons, will only accept certain types
           of input from a tty.  su, notable, will not prompt for a password
           unless it's connected to a tty.

           If this is your situation, use a pseudo terminal ('<pty<' and
           '>pty>').

I don't know IPC::Run much so hopefully you can go from there.


-- 
Michael G Schwern        [EMAIL PROTECTED]  http://www.pobox.com/~schwern/
I hate war as only a soldier who has lived it can, only as one who has
seen its brutality, its stupidity.
        -- Dwight D. Eisenhower

Reply via email to