Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Net::OpenSSH or actually the SSH protocol do not work exactly like that. There is not a remote session where you send commands and get the response back.

Instead there is a binary protocol and on top of it bidirectional IO channels can be created and remote commands or port forwarders attached to them.

In general there is no way to see the IO operations happening because there are handled directly by the master ssh program running on the background. The exception is when you use capturing methods as then, it is Net::OpenSSH who is talking at the other side.

In any case, the module has a debugging mode. For instance, setting...

$Net::OpenSSH::debug = 4|8|64;
... would give you a good idea of what is going on.

Another possibility is to pipe the output of any command through tee so that it appears on the screen and is also saved to a file:

$ssh->system({ stdout_file => ['|-', 'tee'. 'cmd_output.txt ], stderr_to_stdout => 1 }, @cmd);

In reply to Re: Is it possible to see what Net::OpenSSH is doing? by salva
in thread Is it possible to see what Net::OpenSSH is doing? by walkingthecow

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [Lotus1]: I was here

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (11)
    As of 2018-06-18 17:55 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (110 votes). Check out past polls.