I've found the most convenient option is to simply not
use Embperl at all. You're not taking advantage of any of
the templating features of embperl, it makes your life harder
in the end, not easier.

The way I do it is to write a mod_perl content handler.
Annoyingly, a quick look doesn't find any good information
on this on the web (although http://perl.apache.org/ is the
place to look if you want to have a slower look). I use
the book _Writing Apache Modules with Perl and C_, and
i've found it very good, so I haven't needed to look
online much.

Alternatively, write a CGI script and run it under
mod_perl using Apache::Registry, covered at
http://perl.apache.org/dist/cgi_to_mod_perl.html

Basically, I don't think embperl wins you anything here, and
actually makes your life harder.
If you really are desperate to do it in Embperl, do it
as one big

[-

-]

block that writes to OUT, and use http_headers_out to
set the headers like Content-Type (NB: I only think this will work, I
haven't
tried it). I'd be worried about embperl adding stray
newlines to your data, which would be perfectly
acceptable in HTML but might break the processing
of your image.

Michael

> -----Original Message-----
> From: Leeland Heins [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 26, 2002 11:31 AM
> To: [EMAIL PROTECTED]
> Subject: Generating images with EmbPerl
> 
> 
> I have a need to generate images (graphs created with Perl
> modules like GDGraph).  I don't want to store the images
> anywhere, I want the code to generate and send the images.
> I've done this many times in CGI, just by sending out the right
> header for "Content-type: image/gif" or whatever type of image
> it is and then outputing the graphic data.  Should I use the
> meta method for setting the http header, or $http_headers_out?
> Do I need to set optEarlyHttpHeader?  What file handle can I
> print or write the graphic data out to, OUT?  I've read all
> of the docs on the EmbPerl web site, but working with graphics
> really isn't covered directly at all.  Any advice, or ideally
> sample code would be greatly appreciated.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Interactive Investor Trading Limited trading as 
"Ample" is an independent intermediary regulated by 
the Financial Services Authority. Registered in 
England with registered office at 142 Holborn, London 
EC1N 2NQ and Company Registration Number 3699618. A 
member of the AMP Group. We may record and/or monitor 
telephone calls or intercept other telecommunications 
between us. This is to protect both of us and for 
training purposes. 

The information in this email is confidential and may 
be legally privileged. It is intended solely for the 
addressee and access to this email by anyone else is 
unauthorised. If this email has come to you in error 
you must not read or forward the email to anyone, 
please reply to this email and highlight the error. 
Although this message and any attachments are believed 
to be free of any virus or other defect that might 
affect any computer system into which it is received 
and opened, it is the responsibility of the recipient 
to ensure that it is virus free and no responsibility 
is accepted by Interactive Investor Trading Limited 
for any loss or damage in any way arising from its 
use.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to