Since fop is all java (and there's a fop.jar), it should be possible to use Inline::Java to call the fop API directly instead of using the fop commandline utility, where you may be able to pass in a file handle (there is a "embedding" doc in the FOP distribution). There is also XML::ApacheFOP, but I don't think it accepts STDIN or other filehandles as input arguments...it might be worthwhile to research seeing if that could be made to work.