On Wed, 2006-08-02 at 12:50 -0500, Gunnar Wolf wrote:
> Ok, here goes the question: My applications have to deliver binary
> content stored in a database or generated on the fly. How can I do
> this from within my Embperl structure (I'm using the Embperl object
> application), without having to delegate this to a traditional CGI or
> something like that?

Don't know about Embperl object, but for me, it "just works".
Here is some (reduced) code I use for delivering jpeg images:

[-
   # some permission checking and obtaining $imgpath omitted
   if( -f $imgpath && $permission ) {
      $http_headers_out{'Content-Length'} = -s $imgpath;
      $http_headers_out{'Content-Type'} = 'image/jpeg';
      $http_headers_out{'Cache-Control'} = 'no-cache';
      $http_headers_out{'Pragma'} = 'no-cache';
      $http_headers_out{'Expires'} = '0';
      open(I, '<:raw', $imgpath);
      undef $/;
      print OUT <I>;
      $/ = "\n";
      close(I);
      exit 0;
   }
-]
(display error message)

What's important is that there's no white space or anything else before
the first [- or you'll have that at the top of the output.

Regards,
Torsten


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

Reply via email to