in reply to Re: Need some pointers using Expect.pm
in thread Need some pointers using Expect.pm

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.
  • Comment on Re: Re: Need some pointers using Expect.pm

Replies are listed 'Best First'.
Re: Re: Re: Need some pointers using Expect.pm
by waswas-fng (Curate) on Dec 03, 2003 at 23:36 UTC
    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