in reply to /usr/bin/passwd
Alternatively, you could take a look at IO::Tty, and use it to set up a pty, which will make the passwd program behave as if you were sitting at a terminal, but this is basically what Expect is doing behind the scenes.(current) UNIX password:
The problem you were running into may be related to OS buffering issues. You might try something like (code taken from Programming Perl):
which would turn on autoflushing on the ADD filehandle. I'd still recommend using Expect though, as it provides a much more robust and flexible way to accomplish your goal.select((select(ADD), $| = 1)[0]);
Update: I should have looked around a bit for this first, but you also might want to take a look at Unix::PasswdFile and/or Passwd::Solaris.
|
|---|