blackstealth has asked for the wisdom of the Perl Monks concerning the following question:
my ($bwlogin,$bwpass,$bwenable) = split (/,/,$pass{$type}); $telnet->print($bwlogin); $telnet->waitfor('/Password: $/i'); $telnet->print($bwpass); my ($pre,$match) = $telnet->waitfor(Match => '/>$/i', Match => '/Login incorrect/'); $match =~ />/ or return warn "Logon failed for $host \n"; $telnet->print("enable"); $telnet->waitfor('/Password:$/i'); $telnet->print($bwenable); ($pre,$match) = $telnet->waitfor(Match => '/#$/i', Match => '/\% authentication faile +d/'); $match =~ /#/ or return warn "Enable failed for $host \n"; while ($telnet->print("show run")){ ($pre,$match) = $telnet->waitfor(Match => '/\-\-More\-\-$/i', Match => '/#$/i'); if ($match =~ /\-\-More\-\-/){ $telnet->print(" "); } if ($match =~ /#/){ $telnet->print("exit"); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::Telnet while loop not exiting (Newbie Please be Gentle)
by shenme (Priest) on Sep 20, 2003 at 06:53 UTC | |
|
Re: Net::Telnet while loop not exiting (Newbie Please be Gentle)
by blackstealth (Novice) on Sep 20, 2003 at 06:55 UTC | |
by oguzhantepe (Novice) on Feb 14, 2015 at 22:01 UTC | |
by Anonymous Monk on Feb 15, 2015 at 02:28 UTC |