From: Bryan B. <br...@bu...> - 2010-08-20 01:32:35
|
> I am experienced with Expect although I haven't used it for a few years > and > am an advanced-novice with Perl. I am looking for some examples of using > the Expect module with Net::Telnet as i am unable to glean inough > information from the perldoc Expect. If someone could spare a sample > script > or examples I would be much appreciative. > > Thank You > Here is my code: -- snip --> $t = new Net::Telnet (Timeout => $login_timeout, Prompt => "/". $user_prompt ."/", Input_log => $logs_dir ."/". $hostname .".log", Errmode => "return", ); if ( !$t->open($hostname) ) { die $t->errmsg(); } if ( !$t->login($username, $password) ) { die $t->errmsg(); } $exp = Expect->exp_init($t); <-- snip -- Then expect as normal. Also, it has been my experience that this is thread safe. Hope that helps. Bryan Bueter http://sourceforge.net/projects/rover/ |