1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| #########################################
use Connexion; # Connexion use Net::Telnet::Cisco
use WaitFrame ; # composite Frame (affiche un progressBar et un #message avec 2 methodes avance() et stop())
use Tk ;
$main = MainWindow->new();
$main->geometry("550x350");
$main->title("Application Test Telnet");
$main->Button(
-text=>"Connect",
-command=>\&getVersion
)->pack() ;
MainLoop;
sub getVersion()
{
$fr_wait = $main->WaitFrame()->pack() ;
$fr_wait->avance() ;
$main->update ;
$this = Connexion->new();
$this->setHost('192.168.1.10');
$this->setLogin('root');
$this->setPassword('Admin');
$this->setEnable('Admin');
if ( !$this->connect() ) { print $this->getLastMsg(); exit; }
%version = $this->getVersion() ;
$this->disconnect();
$fr_wait->stop() ;
foreach my $tab ( keys %version ) {
print "\n.$tab=>" . $version{$tab};
}
} |
Partager