http://qs321.pair.com?node_id=735015

Lexicon has asked for the wisdom of the Perl Monks concerning the following question:

This isn't exactly a perl question, but I'm hoping there's a perl answer.

I've written a perl wrapper around the ProFit (protein structural alignment) program because I want to cross compare a couple hundred PDBs against each other. I open the program in open3 (or open2, actually) at the start of my code, print lots of commands to the program, and read the output as needed, right? This works great under OS X, but the same code blocks under linux.

I find that when I quit ProFit in linux, it will spew its buffer, so I currently am opening/closing the program thousands of times, but obviously it's inefficient. If you open ProFit on the terminal, it buffers as it should, responding with data after each command.

So how do I unbuffer the stdout from that program? Is there a better Module to use, like IPC::Run or Expect? Perhaps an autoflush like flag or a terminal call?

Thanks a ton guys!