use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/bash\$ $/');
$t->open("sparky");
$t->login($username, $passwd);
@lines = $t->cmd("who");
print @lines;
although I would use ssh if at all available. Expect is too generic for this task. You have to rewrite all of the status tests for the login/disconnect and all the other stuff like what if the telnet bin segfaults while you are running our control script. Net::Telnet was made for this task and is damn good at doing it.
|