in reply to Munging STDIN and STDOUT into one handle
That's about the simplest approach I can think of, especially if you subclass Tie::Handle.