Sebaw, Have you taken a look at my Net::SFTP send file program in the following node Seek Critique of SFTP program, format, structure, overall "Perl"ness ?

It is a fully functional program. While there are improvements to be made, I think you will find it very helpful.

BTW $sftp->put() and $sftp-get() don't return a status for success / failure (I have submitted a bug on rt.cpan.org) like $sftp-new() does. It is necessary that you eval{} and catch{} the results (see main{}).

Earlier this week I found that SFTP does not have a timeout default like FTP... you will need to roll your own alarm to handle this no-repsonse from host (bug reported) - refer to my posting ??? proper use of $SIG{ALRM} with SFTP ???.

The suggestion about testing sftp'ing a file manually and keeping track of all your steps is a good one. This was my MO during testing. You will notice there are many checks in my send program, including those dealing with source directory / file existance and permissions.

I also have a retrieve program that I will be posting in the near future for reference (doesn't hurt to share the knowledge)

Thanks PerlMonks.com for letting me help others as I have been helped.

mikedshelton


In reply to Re: Net::SFTP Help by mikedshelton
in thread Net::SFTP Help by sebawllc

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.