# $ssh_sr contains the remote host like user@host open my $def_in, '<', '/dev/null'; $self->{ssh} = Net::OpenSSH->new($ssh_sr, default_stdin_fh => $def_in); #### # @cmd contains the traceping command to launch remotely via the existing SSH connexion. my $killed; my (undef, $f_stdout, $f_stderr, $pid) = $self->{ssh}->open3(@cmd); while (<$f_stdout>){ # OUTPUT ANALYZED AND PROCESSED HERE $killed = kill(15, $pid); last; } waitpid $pid, 0; close $f_stdout; close $f_stderr;