The process must let go of STDOUT for longerjob() to complete and the page to display.
I believe the simplest way to do this would be a fork(), try open2() or open3() as well. But you may be able to get something to chug along in the same process you started with if you close STDOUT before executing the process.
Does this help ?