in reply to Logfile Viewer in Perl Tk
That seems to work very nicely with a tail command piping output to the script. The other option of course, would be to open tail as a filehandle, like:use Tk; my $mw = MainWindow->new(); my $text = $mw->Scrolled("Text", -width => 80, -height => 25)->pack(-expand => 1); $mw->fileevent(STDIN, 'readable', [\&insert_text]); MainLoop; sub insert_text { my $curline=<STDIN>; $text->insert('end', $curline); }
Then use <FH> instead of <STDIN> in the above.open(FH,"tail -f -n 1 logifle") || die "Could not tail: $!";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Logfile Viewer in Perl Tk
by hackdaddy (Hermit) on Apr 17, 2002 at 07:28 UTC |