Re: Refresh referring page

[prev] [thread] [next] [Date index for 2005/05/03]

From: Issac Goldstand
Subject: Re: Refresh referring page
Date: 14:11 on 03 May 2005
Is there any particular reason why you must split it into 4 pages?  Why
can't you do something like:

local $|=1;
$r->headers_out;
print $tt_header;
foreach my $f (@files) {
    ... process file ...
    print $tt_file_info($f);
}
print $tt_footer;

The idea being do everything in 1 single page.  Split the template into
a header, a footer and information for each processed image, and just
loop the per-picture content instead of looping an entire page.
The only other way I can think of to do this would be to open a second
window which calls a second handler which can share the information of
the first response handler, via shared memory, or a shared cache, or
whatever (or to move the "work" into a cleanup handler and use the
original window with a second handler who can share information with the
cleanup stuff - but I don't know if you can delay reading POST
information beyond the response handler....)

  Issac

Dermot Paikkos wrote:

>Hi,
>
>MP2 RC5, Template,  Image::Magick
>
>I hope this is not off topic, apologises if it is.
>
>I have a perl script written as a handler. It scans a dir for image 
>files and offers the user a chance to convert them from tiff to jpeg. 
>As there can be lots of files of some size, it can take some time for 
>the process to return.
>
>What I wanted was to loop through the files and refresh the page as 
>each file was processed. So I had something like;
>
>
>$r = shift if $ENV{MOD_PERL};
>my $tt = Template->new...
>
>foreach my $f (@files) {
>	my @files_processed;
>	...snip
>	push(@files_processed,$f);
>
>	my $vars = {
>			files => \@files_processed,
>		};
>	$r->content_type('text/html');
>	$r->headers_out;
>	$tt->process($tt_file,$vars)
>      	  || die $tt->error;
>
>} # End of foreach
>
># $r->headers_out;
>
>I thought this would re-send the $vars and headers_out until the list 
>was exhausted but in practise what I get was the page repeated for 
>each file. EG: if there are 4 files I get 4 <html></html> and a messy 
>looking page.
>
>I am not sure what I am doing wrong. If I move the headers_out 
>outside the foreach loop I get to the array contents but I still get 
>the (size of @files_processed) x <html> tags rather than one nice 
>page and I still have to wait for the whole process to complete.
>
>I imagine I am going to have to take another approach but can't thing 
>of one. Does anyone now how to refresh a referring page or loop in 
>the may I described?
>
>Thanx in advance.
>Dp.
> 
>
>
>					
>  
>

Refresh referring page
Dermot Paikkos 13:29 on 03 May 2005

Re: Refresh referring page
Issac Goldstand 14:11 on 03 May 2005

Re: Refresh referring page
Dermot Paikkos 14:44 on 03 May 2005

Re: Refresh referring page
Issac Goldstand 15:14 on 03 May 2005

Re: Refresh referring page
Ron Savage 00:55 on 04 May 2005

Re: Refresh referring page
Dermot Paikkos 08:25 on 04 May 2005

Re: Refresh referring page
Issac Goldstand 10:31 on 04 May 2005

Re: Refresh referring page
Dermot Paikkos 10:44 on 04 May 2005

Re: Refresh referring page
Dermot Paikkos 15:07 on 04 May 2005

Generated at 11:50 on 06 May 2005 by mariachi v0.52