perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Richter - ECOS GmbH" <rich...@ecos.de>
Subject RE: Re: Dynamically generating file for download
Date Fri, 03 Aug 2007 04:44:14 GMT
Hi,

There are already a lot of good replies.

What I actualy would do, would be to use an Embperl Application Object 
(see 
http://perl.apache.org/embperl/pod/intro/IntroEmbperl2.-page-3-.htm), 
that let you separate logic and layout.

The init method is able to tweak serveral parameters of the request and 
to inspect %fdat, before any redering is done. So you can simply do a 
redirect to another page, before your base.epl come into play.

Gerald


------------------------------------------------------------------------
--
Gerald Richter       ECOS electronic communication services GmbH
*******************  SECURING YOUR NETWORK  ********************

Post:       Tulpenstrasse 5            D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de            Voice:   +49 6133 939-122
WWW:        http://www.BB-5000.info    Fax:     +49 6133 939-333

Sitz der Gesellschaft: Dienheim; AG Mainz HRB 6889; GF: W.Heck, 
G.Richter
------------------------------------------------------------------------
--
 
  

> -----Original Message-----
> From: Lelton [mailto:lelton@gmail.com] 
> Sent: Saturday, July 28, 2007 4:52 AM
> To: embperl@perl.apache.org
> Subject: Re: Dynamically generating file for download
> 
> On 7/28/07, Ed Grimm <edgrimm@dsblade00.wat.us.ray.com> wrote:
> 
> > The way you word this seems to me ambiguous.  Are you needing 
> > assistance in how to do the two options I mentioned?
> 
> I'm not sure how I can articulate it clearer. I have a 
> working embperl based website with lots of included epl files 
> that build page templates, etc. Every subsequent html file 
> contains text/code which sits inside each page template which 
> is automatically generated and then served.
> 
> What I want to do for ONE particular page is have it generate 
> a file that can be downloaded. Now, the user visits the 
> particular html page (which is rendered with all the 
> templates), fills in some details, clicks submit (which is a 
> FORM action back to the same page) and then the HTTP response 
> is the file to download.
> 
> Now, this can be easily achieved by some [$if defined..] 
> statements to check if the form variables have been filled in 
> and then response back the the file to download.
> 
> The problem is that the file download would include the HTML 
> templates that are provided as part of base.epl, etc thus 
> making the file download littered with HTML garbage. Now, I 
> could circumvent that by placing it all in a new directory 
> and have a null base.epl however that does not solve my 
> problem because I want the templates rendered in the first 
> place when the form variables need to be specified!
> 
> So if that's not clear enough, here's some pseudocode:
> 
> $ cat generate.html
> 
> [$if !defined(form variables)$]
> <!-- stuff in base.epl with Execute, etc will be automaticall 
> included here -->
> Text:
> <FORM ACTION="generate.html">
> ....
> </FORM>
> Text
> <!-- and here -->
> [$else$]
> call_some_function_that_prevents_any_templates_from_being_processed();
> [-
> # perl to generate the file.
> $header{'content_type'} = 'text/text';
> print OUT ...
> -]
> [$endif]
> 
> Is that at all possible with Embperl?
> 
> Thanks.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
> 
> 
> ** Virus checked by BB-5000 Mailfilter ** 
> !DSPAM:416,46aab134266951798513471!
> 
> 

** Virus checked by BB-5000 Mailfilter **

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


Mime
View raw message