adam.lapins has asked for the wisdom of the Perl Monks concerning the following question:

Has anyone ever seen this error message before?
Can't set socket non-blocking: Bad file descriptor at C:/Perl/lib/Net/ +SSH/Perl.pm line 213, <GEN0> line 1
The code that is generating the error is:
#vpn.pl #log onto vpn and get config open(VPNOUTFILE,">vpnoutput.txt"); use Net::SSH::Perl; my $policy = 0; my $gateway = 0; my $vpn = 0; my $address = 0; my $group = 0; print "\nPlease enter IP: "; $ip = <STDIN>; print "\nPlease Enter Username: "; $user = <STDIN>; print "\nPlease Enter Password: "; $password = <STDIN>; my $ssh = Net::SSH::Perl->new($ip); $ssh->login($user, $password); my($stdout, $stderr, $exit) = $ssh->cmd(get sys);

Replies are listed 'Best First'.
Re: Net::SSH::Perl error message
by idsfa (Vicar) on Jun 30, 2005 at 17:10 UTC

    You need to chomp and or die.

    $ip = <STDIN>; # Remove the trailing newline ... chomp $ip; . . . # Make sure your connection opened my $ssh = Net::SSH::Perl->new($ip) or die($!);

    You might also want to turn on the debugging option described in the docs.


    The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. -- Cyrus H. Gordon
Re: Net::SSH::Perl error message
by salva (Canon) on Jun 30, 2005 at 18:19 UTC
    IO::Socket::blocking (or was it IO::Handle::blocking?) does not work on some versions of perl for windows (the bug report).
Re: Net::SSH::Perl error message
by davidrw (Prior) on Jun 30, 2005 at 15:52 UTC
    Can you post the snippet that generated it?
      updated