I'm not running Linux so I can't really test this, but something like this should do what you are seeking.
**Untested**
use strict;
use warnings;
use Tk;
use Tk::ROText;
use Lirc::Client;
use IO::Select;
my $top = MainWindow->new;
my $text = $top->ROText(
-background => 'white',
)->pack;
my $lirc = Lirc::Client->new( 'progname' );
my $select = IO::Select->new();
$select->add( $lirc->sock );
$top->repeat( 200, \&getcodes );
MainLoop;
sub getcodes{
if( my @ready = $select->can_read(0) ){
my @codes = $lirc->next_codes;
$text->delete( '1.0', 'end' ) if @codes;
for my $code (@codes){
$text->insert( 'end', "$code\n" );
#do whatever else you want with $code
}
}
}
|