perlpal has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl Monks,

I've been using Expect all along to automate SSH sessions . How is Net::SSH different from Expect with respect to the same ?

Are there any definite advantages in using the latter over the former ?

Thanks in advance.

Replies are listed 'Best First'.
Re: Expect vs Net::SSH
by zentara (Cardinal) on Aug 10, 2010 at 15:02 UTC
    The new standard to use now is Net::SSH2. Expect has to do alot of printing values, then waiting and filtering replies, but it works well if your system ssh clients are working well. Look at A little demo for Net::SSH2 and see how many lines of code it takes to do an operation, compared to your Expect scripts. Net::SSH2 has more concise code. You decide which code is better.

    If you use your system's commandline ssh utilities often, and are familiar with their usage, then Expect may be better for you; just because it's easier on the mind to have consistency in remembering options, etc.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku
      The new standard to use now is Net::SSH2

      As the author of Net::OpenSSH I can not agree with you. Net::SSH2 is a great module but not the only one around!