in reply to Perl non-blocking IPC
Anyways, with the lack of details, I think you probably need to kill the $pid of program_ipc, otherwise post details of what this program outputs, and how it operates.
In the meantime, try something like the following, and remember, you may need to use Proc::Killfam instead of a plain kill, depending on whether you get the pid of any shell running the program.
#!/usr/bin/perl # tktail pathname use warnings; use strict; use Tk; my $pid = open(H, "tail -f -n 25 $ARGV[0]|") or die ; my $mw = MainWindow->new; my $t = $mw->Text(-width => 80, -height => 25, -wrap => 'none'); $t->pack(-expand => 1); $mw->fileevent('H', 'readable', [\&fill_text_widget, $t]); $mw->OnDestroy(\&quitCB); MainLoop; sub fill_text_widget { my($widget) = @_; my $text = <H>; $widget->insert('end', $text); $widget->yview('end'); } # end fill_text_widget sub quitCB { kill 9,$pid or die $!; exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl non-blocking IPC
by brian42miller (Sexton) on Jul 06, 2011 at 17:21 UTC | |
by zentara (Cardinal) on Jul 06, 2011 at 18:27 UTC | |
by brian42miller (Sexton) on Jul 07, 2011 at 16:26 UTC | |
by Somni (Friar) on Jul 07, 2011 at 00:23 UTC |