On 23/09/2019 14:31, Andreas Mock wrote:
Hi Thomas,

why not implementing the follwoing steps.

1) create tmp file.
2) convert to tmp file
3) if everything worked fine reading file, setting appropriate headers and 
print content and afterwards delete tmp file.
4) if something went wrong you can send an error page with appropriate headers 
and code.

I would avoid messing around with STDOUT.

Best regards
Andreas
Thanks, That seems to work well, it just seems a shame to need to create a temp file.

Interestingly later in the script where under a different condition it pipes into gs and out through stdout through the command line, and it works fine.





-----Ursprüngliche Nachricht-----
Von: Thomas Kenyon <t...@polybond.co.uk>
Gesendet: Montag, 23. September 2019 14:52
An: modperl@perl.apache.org
Betreff: STDOUT Problem migrating a site to mod_perl

I have run into an odd problem when migrating a site to use mod_perl.

The script in question, builds some postscript into a variable, then
uses psconvert (from Postscript::Convert) to change that into a png and
sends that back to the webserver. (headers are set up earlier in the
script).

This seems to work well with mod_cgi but doesn't work with mod_perl
using either ModPerl::Registry or ModPerl::PerlRun.

Annoyingly psconvert doesn't return the converted image, instead it
dumps it to a file (or stdout).

I have tried to re-implement this using GSAPI, but GSAPI doesn't seem to
build on any of my machines. (all debian 9/10 based).

      use PostScript::Convert;
      psconvert(\$ps, '%stdout%' , format => 'png', resolution => '72',
paper_size => '6.5x4');

I've searched through as much documentation as I can find, and tried
various things, but none seem to work.

TIA for any guidance.

Reply via email to