Forum How do I...?

Newbie princexml and perl question

ewhitten
Currently trying to evaluate princeXML and I can't seem to get it to print via perl CGI. Here's what I'm trying:

open(PRINCE, "| prince --debug --log=/tmp/test.log -");
$r->header_out('Content-disposition' => ("attachment; filename=foo.pdf"));
$r->content_type('application/pdf');
$r->send_http_header();

print PRINCE "<html><body><h1>Hello, world!</h1></body></html>";
close PRINCE;


When I request the URL of this script, it never returns and the prince process shoots up to 99.9% CPU and sits there forever. Calling from the command line works fine, however. This is on an AMD64 Ubuntu 7.04 server. Am I missing something very basic here? I've copied this example directly from the documentation.

Thanks in advance.
mikeday
Do any errors show up in the web server logs? Is anything being written to the Prince log file?
ewhitten
That's the strangest part. Nothing is written out to the server or princexml logs. It will just sit there until I restart apache2 or kill the prince process.

One solution that does seem to work is writing the PDF to disk, closing the file handle, then re-opening it to download to the client.
mikeday
That is strange, seems to be some kind of deadlock issue, which can be quite difficult to debug. Writing the PDF to a temporary file is probably the easiest workaround for the problem, but we'll try to diagnose the issue.