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

I am trying to simply execute ssh login from my local machine to remote server using the Net::SSH::Perl and I am getting error "Can't locate object method "login" via package "ssh" (perhaps you forgot to load "ssh"?) at ./test5 line 13, <GEN0> line 1" and my code is given below

#! /usr/bin/perl use Net::SSH::Perl; my $host = "192.168.1.6"; my $user = "testing"; my $password = "redhat"; my $ssh = Net::SSH::Perl->new($host); ssh->login($user, $password); my($stdout, $stderr, $exit) = $ssh->cmd("ls -l /home/$user");

Replies are listed 'Best First'.
Re: Net::SSH linux
by mirod (Canon) on Jun 27, 2012 at 13:11 UTC

    There is (at least!) a typo in your code: ssh->login should be $ssh->login.