in reply to trapping output from /dev/tty
You can use the Expect module to run your program on a PTY (or perhaps IPC::Run or IO::Pty if you don't really need Expect's send/expect chat-y functionality).