in reply to Exec Fork Trick

You may be able to get this to work without running Expect by using IO::Pty. Under Unix, the /dev/pty arrangement allows you to have pseudo-tty pairs that look like real tty lines, but you can do I/O to (this is what Expect uses, as well as xterm, etc.).

You'd set up your child process (passwd) with the slave pty as the stdin, stdout, and stderr.

Another CPAN module that may help in conjunction with IO::Pty is IPC::Run which allows you to run processes with pty connections. From its manpage:

· 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>').