in reply to Need some pointers using Expect.pm

Why not use Net::Telnet instead? it is specialized for the tasks that you are trying to perform.


-Waswas

Replies are listed 'Best First'.
Re: Re: Need some pointers using Expect.pm
by TASdvlper (Monk) on Dec 03, 2003 at 23:23 UTC
    Funny you ask. I'm actually researching what's better, Expect or Telnet (which is the original post that triggered this post). I've heard agreements that both methods are good, but there are more dependancies regarding telnet.
      Seems easy to me...
      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.


      -Waswas