Hi Monks,

I am Looking for some advice with regards to Net::SFTP::Foreign which I think is a fantastic module.

I am trying to beef up the error trapping from my scripts to help me diagnose connect errors. When a connect fails with this module, it normally returns "Connection to remote server is broken" and the real error is sent to the STDERR for the console I am running. I assume the error is being sent to STDERR by the ssh executable its self.

I have had a look at Foreign.pm and I believe its because teh module uses ICP::Open2 to spawn the ssh.exe as this only allows STDIN and STDOUT to be captured.

I thought I would be clever and experiment with changing it to use ICP::Open3 and adding a STDERR file handle to the code.

When a connection fails, I can indeed read the STDERR file handle and the message from ssh is there (such as "Connection Timed Out" or "Permission Denied") which is great. Problem is that the module will not connect to servers which should work. The SSH command just hangs now so the Net::SFTP::Foreign->new method never returns.

Have I looked at this too simply as this is something I have never needed to look at before? Is what I am trying to achieve possible and am I going in the right direction?

Any help would be most gratefully appreciated.

Thanks,

Al


In reply to Net::SFTP::Foreign Connection STDERR by allyc

Title:
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, details, 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, summary, 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.