use strict; use mship; use Tk; my $host; $|++; #First create a new mainwindow my $mainwindow = new Tk::MainWindow(); #Then create a textwidget (called 'Scrolled', with subtype 'Text") my $text = $mainwindow->Scrolled("Text", -scrollbars => 'se')->pack(-expand => 1, -fill => 'both'); for ( 0 .. 54 ) { get($_); last if ($_ == 53 ) } # create a closebutton my $button = $mainwindow->Button(-text => "close", -command => sub {$mainwindow->destroy()})->pack(); # start the main loop! MainLoop; sub get { my $node = shift; $host = sprintf ("%02d", $node) ; my %status = mship::connection("192.9.210.1$host", "13"); my $stats=($status{status} == 0) ? "Up" : "Down"; $text->insert('end', "$status{remote_name} is $stats\n"); }