in reply to net ssh loop

We will not be able to help you unless you post your code!

See How (Not) To Ask A Question.

Replies are listed 'Best First'.
Re^2: net ssh loop
by Anonymous Monk on Jul 21, 2010 at 11:54 UTC

    Hi, exactly same error happens with simpler code.

    <code> my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my ($LS_OUT, $LS_ERR, $LS_EXIT) = $ssh->cmd('ls -la'); print "This is END where i want to see\n"; <code> _jho

      First, to include code in your posts use <code>your code here</code>, there is a backslash in the closing tag!

      Regarding your original question, wrap the code that can fail inside eval:

      eval { my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my ($LS_OUT, $LS_ERR, $LS_EXIT) = $ssh->cmd('ls -la'); }; $@ and print "SSH failed: $@"; print "This is END where i want to see\n"
        Hi, create, it works thanks. -jho

      i have tried already. <code> my $ssh = Net::SSH::Perl->new($host); if ($ssh->login($user, $pass)){ my ($LS_OUT, $LS_ERR, $LS_EXIT) = $ssh->cmd('ls -la'); }else{ print "The END\n";} <code>