in reply to Tk progressive search

Here's an attempt at a solution.

This uses Tk::IO so it requires the query to be in a separate process.
I had no luck trying to use ->kill, so what this does is use a closure to ignore any lines from a query that is not the latest from showing up in the list.
Slow queries are simulated with a sleep 1.

Seems to work :)

#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::IO; use Tk::ROText; my $sequence = 0; my $mw = MainWindow->new; $mw->geometry( '+349+440' ); $mw->Button(-text => 'Exit', -command => sub {$mw->destroy}, )->pack(-fill => 'x'); my $entry = $mw->Entry( -validate => 'key', -validatecommand => \&lookup, )->pack(-fill => 'x'); my $text = $mw->ROText( )->pack; MainLoop; sub lookup { my $newword = shift; my $want = ++$sequence; $text->delete('1.0', 'end'); if( $newword =~ /^\w+\z/ ) # avoid shell error { Tk::IO->new( -linecommand => sub { $want == $sequence and $text->insert(end => shift) }, )->exec("sleep 1 ; look '$newword' | head -20"); } return 1; }