#!/usr/bin/perl use Tk; use Tk::HList; use Tk::ItemStyle; use Data::Dumper; my $user = $ARGV[0] || 'alex'; my $hash = {}; my ($location,$age,$use,$vendor,$feature); my $sec = 5000; #default value #gui variables my ($hl,$ok,$alert); # Making the Gui my $mw = new MainWindow; $mw->geometry("500x200"); my $userframe = $mw->Frame(-width=>5,-height=>10)->pack(-side=>'top',- anchor=>'nw'); $userframe->Label(-text => "USER: $user")->pack(-side => 'left', -anchor => 'nw',-padx => 0); $userframe->Label(-text => "Set time")->pack(-side => 'left',-anchor => 'w',-padx => 0); my $frequency = $userframe->Entry(-width=>5,-textvariable=> \$sec) ->pack(-side => 'left',-anchor => 'nw',-padx => 0); my $hlistframe = $mw->Frame()->pack(-fill => 'both', -expand => 1); $hl = $hlistframe->Scrolled('HList', -scrollbars => 'ose', -columns =>4 , -header => 1, -width => 100, -command => sub {print "AAA\n";}, -selectmode => 'browse', )->pack(-fill => 'both',-expand =>1 ); my $label1 = $hl->Label(-text => "location", -anchor => 'w'); $hl->headerCreate(0,-itemtype => 'window',-widget => $label1); my $label3 = $hl->Label(-text => "Age", -anchor => 'w'); $hl->headerCreate(1,-itemtype => 'window',-widget => $label3); my $label4 = $hl->Label(-text => "phone", -anchor => 'w'); $hl->headerCreate(2,-itemtype => 'window',-widget => $label4); refresh(); # called to start the first refresh # the timer is now at the end of the refresh() sub MainLoop; sub refresh { # 1 here you read the file # 2 do your regexes # 3 test to see how many paths you have thru info('children') # 4 reconfigure the existing paths with new data # 5 if new paths are needed add them, if you have too many # existing paths, hide them # finally call it again later # make a lower bound for timer # in case your user sets $sec to 0 if( $sec < 1000){ $sec = 1000 } $mw->after( $sec, \&refresh); }