papaismurf has asked for the wisdom of the Perl Monks concerning the following question:
##text Scrolled## $textsc = $txtget->Scrolled ('Text', -scrollbars => 'oe', -width=> 33, -height => 32)->pack; ##Button## my $botaotest = $framebtest -> Button(-text => 'Test Ips!',-command => +\&gotest) -> pack(-side => 'left', -expand => 1,-ipadx => 145); sub gotest{ if ( @$ref){ $textsc->insert('end',"Lets see Wich Ips are ON...\n"); @ipsproxy = map("$_->{ip}", @$ref); $p = Net::Ping->new("icmp"); $p->bind('187.78.223.205 '); @validos = (''); foreach $aaa (@ipsproxy) { print "$aaa is "; unless ($p->ping($aaa, 3)){ print "Host OFF\n"; }else{ push @validos, "$aaa"; printf "ALIVE!!!\n"; sleep(1); } } $p->close(); @nwvalidos = join("\n",@validos); $textsc->insert('end',"Ips Alive:@nwvalidos"); }else{ $textsc->insert('end',"#########ERROR#########\n...I Need Ips to test, + dude!!!"); } }
Whats my problem?
1- When i press Test Buttom, if the array are empty, is shown in my Text Scrolled the msg "#########ERROR#########...I Need Ips...." OK It works! My problem is when i click Test buttom and my array have my ip list, the phrase "Lets see Wich Ips are ON..." is shown only after my ips tests, I need when i clicker in test buttom, the phrase appear first, and then my ip tests start.
>2 - All my ips test results(from foreach command) are being shown in my console, like
"187.115.68.237 is ALIVE!!!
187.44.99.77 is ALIVE!!!
200.131.50.10 is ALIVE!!!
200.198.42.245 is Host OFF
Theres some way to these tests are shown in real time in my Text/Scrolled?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: TK, insert and foreach
by choroba (Cardinal) on Jun 23, 2011 at 08:45 UTC | |
by papaismurf (Novice) on Jun 23, 2011 at 20:28 UTC | |
|
Re: TK, insert and foreach
by zentara (Cardinal) on Jun 23, 2011 at 11:20 UTC | |
by papaismurf (Novice) on Jun 23, 2011 at 20:31 UTC | |
by zentara (Cardinal) on Jun 24, 2011 at 14:35 UTC |