Hi Des, I would suggest that you look into AJAX and try to handle rather more on the client/javascript side. If you will permit I will give some hints on how I would approach it. There are alternatives but I primarily use the YUI framework for javascript stuff.
1.) The CGI::Application part should largely just initiate the process. 2.) You need a second back-end process (not strictly part of the web application) to do the actual work. 3.) Your CGI::Application should support a run mode that returns a progress report. This would not be a web page in the normal sense. The MIME type should probably be "application/json" rather than "text/html" and you should wrap it with the JSON perl module. 4.) The YUI connection manager provides a good AJAX framework. http://developer.yahoo.com/yui/connection/. Using the connection manager the client side gets the JSON data described in 4. and parses it using http://developer.yahoo.com/yui/json/ . 5.) You do the actual display using http://developer.yahoo.com/yui/progressbar/ . If that is all too javascript heavy for you then you should be able to at least do 1. and 2. Then your web page should display the status and put in some automatic refresh in the headers until the work is complete. The one thing you really cannot do is leave the browser wating whilst the work completes. Nicholas > Message: 1 > Date: Fri, 18 Jun 2010 14:40:06 +0100 > From: Des Herriott <des.herri...@gmail.com> > Subject: [cgiapp] Using HTTP chunked transfer with CGI::App? > To: cgiapp@lists.erlbaum.net > Message-ID: > <aanlktimlmmkxcuoqeoxxcd25mg7b4wit6nn7skman...@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > I'm working on a CGI::Application app which needs to run some potentially > slow tasks, and I want to keep the user updated about its progress. > The runmodes I'm using: > > - show_request_form - display the initial request form > - show_preview - once the user has entered their data, display > a list of the work that will be done > - submit_request - carry out the actual work > > The submit_request runmode will run several tasks, some of which could > be quite slow. The overall run time of this runmode could be 20-30 > seconds, so I want to keep the user updated after each task is completed. > It seems like HTTP chunked transfer is what I need here, but I'm having > trouble understanding how to make it work with CGI::App. Since CGI::App > runmodes basically constructs the entire page and return it, I can't see > a way to return one chunk of the page at a time. > > Am I missing something, is there perhaps a useful a plugin to > progressively render some output, or is this just not going to work? > > Thanks, > > ##### CGI::Application community mailing list ################ ## ## ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ## ## ## ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ## ## ################################################################