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

Below ismy script:

#!/usr/bin/perl -w use strict; use Net::SSH2::Perl; my $host = "10.160.12.26"; my $sshusername = "mktftp"; my $sshpasswd = "markdb"; print "Start\n"; my $ssh = Net::SSH2::Perl->new($host, debug => 1, protocol => 2); print "Before login\n"; my $loginStatus = $ssh->login($sshusername,$sshpasswd); print "After login\n"; my $command = "date"; my $stdout; my $stderr; my $exit; eval { ($stdout,$stderr,$exit) = $ssh->cmd($command); }; if ($@) { if ($@ =~ m/Permission denied/i) { print "Authentication failed\n"; exit 1; } } print "$stdout\n";

when I run it, show error:

Can't locate Net/SSH2/Perl.pm in @INC (you may need to i rl module) (@INC contains: C:/Strawberry/perl/site/lib C /lib C:/Strawberry/perl/lib .) at C:\\conn.pl line 4. BEGIN failed--compilation aborted at C:\\conn.pl line 4.

Could you please tell me why? I am trying to connect from Windows 7 to Linux

Replies are listed 'Best First'.
Re: try to connect to Linux
by Anonymous Monk on Sep 29, 2014 at 20:55 UTC

    Please use <code> tags to format your code.

    Your error message is missing a piece, but if you read the actual message, you'll see that it's giving you the useful hint that the Net::SSH2::Perl module is missing, which isn't surprising because there is no such module. Perhaps you meant Net::SSH::Perl?

      Edit: saying same thing