[Catalyst] streaming output to view in real time

David Morel david.morel at amakuru.net
Tue Apr 10 17:13:04 GMT 2007


Le 10 avr. 07 à 17:57, Jimmy Cooksey a écrit :

> Hi,
>
> I'm looking for a way to redirect STDOUT from an external application
> directly into my website, updating in real time.
>
> My original plan is to do something like this:
>
> 1.  Controller popen's some program
> 2.  Reads the file descriptor
> 3.  Redirects each new line into some DIV in my view, showing each new
> line in real time.
>
> This controller would be called after a form submit.
>
> #3 is the part I don't know how to do, or if it's even possible.  I
> haven't seen a $c->res method that lets me update directly into a DIV,
> which I was kind of banking on.  The "real time" part is pretty
> imperative also.  I can't get away with waiting for the program to
> execute, then dumping all of it's output at once.
>
> Any general guidance is greatly appreciated.

You want ajax here. I designed stuff maintaining an HTTP connexion  
open for hours, but it was not pretty.

I'd run the task using POE / IPC::Run or Expect and leaving the  
server process alone. You'd then use Ajax to query the running process.

David Morel



-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 155 bytes
Desc: =?ISO-8859-1?Q?Ceci_est_une_signature_=E9lectronique_PGP?=
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070410/332c780e/PGP.pgp


More information about the Catalyst mailing list