hackdaddy has asked for the wisdom of the Perl Monks concerning the following question:
- or -$> tail -f logfile | logfileviewer
I have a while loop to get <STDIN> as seen below:$> ls -l | logfileviewer
However, I only get the following error when closing the MainWindow:#!/usr/local/bin/perl -w use Tk; use Tk::HList; use Tk::ItemStyle; $|=1; ######################## # Text Window my $mw2 = MainWindow->new; $mw2->title("LogViewer"); my $tex = $mw2->Scrolled("Text", -background => 'grey', -foreground => 'white' )->pack( -fill => 'both', -expand => 1, ); #create text tag $tex->tagConfigure('red', -foreground => 'red' ); Tk::MainLoop; sub DisplayItem { print "Called DisplayItem\n"; $tex->insert("end", "$_[0]", 'red' ); } while( <STDIN> ) { print "While called with: $_\n"; chomp; &DisplayItem( $_ ); } # end while
Any assistance would be appreciated. Thanks.While called with: random text in file Called DisplayItem Failed to AUTOLOAD 'Tk::Frame::insert' at logviewer line 37
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Logfile Viewer in Perl Tk
by the_slycer (Chaplain) on Apr 17, 2002 at 04:27 UTC | |
by hackdaddy (Hermit) on Apr 17, 2002 at 07:28 UTC |