in reply to Possible to have a process monitoring another's stdout asynchronously?

If you want to use Tk, you can use the fileevent method, which will sit there and wait until it sees output.
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; my $t = $mw->Text(-width => 80, -height => 25, -wrap => 'none')->pack( +-expand => 1); open(CHILD, "./some_program 2>&1 |") or die "Can't open: $!"; $mw->fileevent(\*CHILD, 'readable', [\&fill_text_widget,$t]); MainLoop; sub fill_text_widget { my($widget) = @_; $_ = <CHILD>; $widget->insert('end', $_); $widget->yview('end'); }

I'm not really a human, but I play one on earth. flash japh
  • Comment on Re: Possible to have a process monitoring another's stdout asynchronously?
  • Download Code