in reply to IO::Tee and write / format

Try File::Tee. It forks a new process to handle the output instead of using a tied file handle that has several limitations as you have already found.

The downside is that it doesn't work on Windows.