perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Jagdmann <...@cubic.org>
Subject Re: Dynamically generating file for download
Date Tue, 31 Jul 2007 09:25:46 GMT
Hello Lelton,

I usually do it the same way as Ed suggested. Use a different file 
extension for Embperl pages and pure perl pages. Here's an exerpt from 
my apache.conf:


Options +ExecCGI
AddHandler cgi-script .pl
<FilesMatch ".*\.html$">
   SetHandler  perl-script
   PerlHandler HTML::EmbperlObject
</FilesMatch>

So .html files are handles by Embperl and .pl files are just plainly 
called. If performance would be important for this website I could have 
used the mod_perl registry for the .pl files.

The form (in your Embperl code) then looks like:

<form action="download.pl">
  <input name="whatever"/>
</form>

And my stub for download.pl:

#!/usr/bin/env perl
use CGI;
my $cgi=new CGI;
my $whatever=$cgi->param('whatever');
my $c=magic_function_to_generate_content_into_scalar($whatever);
print "Content-Type: image/png\n\n";
print $c;
exit 0;

-- 
---> Dirk Jagdmann ^ doj / cubic
----> http://cubic.org/~doj
-----> http://llg.cubic.org

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message