I think ajax would be your friend here. You could just make an ajax call to some function to check the status of the file copies and then update the DOM directly instead of refreshing the whole page. Or the actual call to start the copy can be made via ajax instead of the call to check the status that way your js code for that page can call the copy file function on the server sequentially for each file and update the page in a loop. There are a lot of ways to do this. You might even want to look into having a background process launched to do the actual copy so you don’t run into http timeout issues and just have your controllers start and check the copy process.
Thanks, ------------------------------------------ Ali Mesdaq (CISSP, GIAC-GREM) Sr. Security Researcher Websense Security Labs http://www.WebsenseSecurityLabs.com ------------------------------------------ -----Original Message----- From: Dermot [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 23, 2008 3:53 AM To: The elegant MVC web framework Subject: [Catalyst] A suitable method to redraw a page Hi, I have a controller who's job is to copy some files (4-6). These files can be quite big and the time it takes has been causing what looks like timeouts on the server. [Tue Sep 23 09:48:55 2008] [error] [client x.x.x.x] FastCGI: comm with server "/var/www/MyApp/script/motion_fastcgi.pl" aborted: idle timeout (30 sec), referer: http://somehost/cgi-bin/doit.cgi [Tue Sep 23 09:48:55 2008] [error] [client x.x.x.x] FastCGI: incomplete headers (0 bytes) received from server "/var/www/MyApp/script/myapp_fastcgi.pl" I could increase the timeout period on the httpd daemon. I thought a more elegant solution would be to present a page with the results for each file after it's copied that is updated with the status of each copied file. So the same window refreshes and the next file is listed with the copy status. I have achieved this in the past (CGI) by putting a form on the page and using javascript/onload/submit while items < 1. It's a bit of a hack but it works. Is there a method within Catalyst that might help me reach my goal? Something akin to Chained perhaps. Alternatively can I loop through the list of files and $c->{template} = 'files/rename.tt2'. My experiments haven't been successful. I get the whole page of results. Is there something like $c->forward that I should be using here? Here an abridged versions of the controller. sub rename : Local { my ($self, $c) = @_; die if ($c->request->param('id') !~ /\d+/); my $list = getFilesBySubID($c, $c->request->param('id')); my @moved; foreach my $file ( @{$list} ) { my $source = $file->path; my $type = getFileTypeFromName(basename($file->path)); my %state = ( 'id' => $c->request->param('id'), 'source' => $file->path, 'distin' => undef, ); my $path = getPathFromNumber($c->request->param('splnumber'), $type); my $x = copy($source,$path) or warn "Cannot copy $source to $path: $!\n"; $state{'success'} = $x; $state{'distin'} = $path; } else { $state{'success'} = 0; } push(@moved, \%state); $c->stash->{moved} = [EMAIL PROTECTED]; $c->stash->{template} = 'files/rename.tt2'; } } I hope this makes sense :-/. Any advice would be appreciated. Thanx, Dp. _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ Protected by Websense Messaging Security -- www.websense.com _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/