On 9/11/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > How to automate ssh login with Expect.pm? > > I found an example to automate telnet login at > http://search.cpan.org/~rgiersig/Expect-1.21/Expect.pod#The_examples_in_the_tutorial_don > > I had done > yum install perl-Expect > yum install perl-Net-SSH > > My perl script is: > #!/usr/bin/perl > # > use Expect; > use Net::SSH; > > $remotehost = "172.20.11.242"; > > my $ssh = new Net::SSH ($remotehost) # see Net::Ssh > or die "Cannot ssh to $remotehost: $!\n";; > > ... > > $ ssh.pl > Can't locate object method "new" via package "Net::SSH" at ./ssh.pl > line 24.
Net::SSH does not have an OO interface. It provides five functions. Perhaps you are thinking of Net::SSH::Perl? from perldoc Net::SSH ssh('[EMAIL PROTECTED]', $command); issh('[EMAIL PROTECTED]', $command); ssh_cmd('[EMAIL PROTECTED]', $command); ssh_cmd( { user => 'user', host => 'host.name', command => 'command', args => [ '-arg1', '-arg2' ], stdin_string => "string\n", } ); sshopen2('[EMAIL PROTECTED]', $reader, $writer, $command); sshopen3('[EMAIL PROTECTED]', $writer, $reader, $error, $command); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/