in reply to test version of ssh from windows

I ran your code on my OS X machine, and it worked in the way you described that you wanted it to work.

I got a success, I tried an invalid port and got a "connection refused" message, and I tried an invalid host and got an "Invalid argument" message.

Feels like this is an issue with host & port you're trying to connect to, instead of a code probelm.

Replies are listed 'Best First'.
Re^2: test version of ssh from windows
by mariog (Acolyte) on Aug 11, 2015 at 15:28 UTC
    Hello

    it works but the messages are too long.

    I do not know if I can change the text of the variable $!?

    .

    This script will be integrated into nagios later with nsclient and nrpe so the messages have be short.

      In my reply above using eval, you can trap and then reword the errors as you see fit. Here's a short example.

      eval { open my $fh, '<', 'asdf' or die $!; }; if ($@ =~ /No such file or directory/){ print "short error msg\n"; # or... die "short msg"; }