It did not work the way I used it...it still just dies.
Any more ideas...
heres the modified code..
use Net::Telnet ();
eval {
$t = Net::Telnet ->new(Timeout => 10,
Prompt => '/.*# $/');
};
warn $@ if $@;
$t->open("10.0.0.$num") || die "can't telnet to $num\n";
$t->login('$log','$pwd');
$t->cmd("cd /home/dir");
@lines = $t->cmd("ps uax");
...
Thanks.
HeffaK | [reply] |
Go back and re-read my original post. You need to move
all the operations on $t inside the eval {}. It's probably
the open or login that's die()ing, not the Net::Telnet->new, anyway.
If there's a failure at some point, you probably want to
give up on the entire telnet session. After all, if the
login fails, what's the chance of "cd /home/dir" working?
If you put everything in the eval {}, the first one that
dies will jump to the end of the eval block, skipping over
the other commands.
| [reply] |
That did it... :) Thank you and Thank you again.
HeffaK
| [reply] |