Re: [Catalyst] streaming output to view in real time

2007-04-11 Thread Jimmy Cooksey

Ok, I'm requesting a design sanity check :-)

What I'd like to do is have a view come up with a form, and a div for
my streaming output.

The form is used to execute an external serverside program.  Data
fields in the form are basically just command line arguments for the
program.  The form submit controller action popen's my application,
and writes the STDOUT to my database, auto-incrementing an id value
along the way.  Meanwhile I've got one of those fancy processing
data ajax things to indicate that the program is being executed next
to my form.

Also, meanwhile, there will be a timer based javascript function,
which runs an httprequest back into my controller, and receives the
updates to the database (which are being populated by my external
program).  It only looks for entries with id  $last_id.  If it finds
any, it adds the line(s) into the div.  This would continue as long as
the page is open, and the initial $last_id would just be passed in
when the page loads.

Sound feasible?  I'm asking this broad question, because this will be
my first catalyst project, and I'd like to get started in the right
direction.

On 4/10/07, David Morel [EMAIL PROTECTED] wrote:


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




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/





___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] streaming output to view in real time

2007-04-11 Thread Perrin Harkins

On 4/10/07, Jimmy Cooksey [EMAIL PROTECTED] wrote:

I'm looking for a way to redirect STDOUT from an external application
directly into my website, updating in real time.


Randal Schwartz wrote a good example of how to do this with a forked
process and some kind of shared data store:
http://www.stonehenge.com/merlyn/LinuxMag/col39.html

- Perrin

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] streaming output to view in real time

2007-04-10 Thread Jimmy Cooksey

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.

Thanks,
Jimmy

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] streaming output to view in real time

2007-04-10 Thread David Morel


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





PGP.sig
Description: Ceci est une signature électronique PGP
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/