TCL's Expect was very good at fooling processes into
believing that they were dealing with a terminal. I
would be highly surprised if the Perl version, the Expect
module, was not likewise.
So try to launch latex through Expect and see how well that
works. (I believe that the Cookbook recomments this
approach but I don't have a copy at home.)