I've never used Net::SFTP, but I have a few suggestions...
  1. When posting to PerlMonks, in addition to posting a complete sample program demonstrating your problem, you should post the exact error message you are getting.
  2. I don't see anything in the docs for Net::SFTP (v0.05) that says put will return true on success. Are you sure the copy isn't working just fine, and the only problem is that you are calling "die" ?
  3. Are you sure that the local file you want to put is "readable" by your local user?
  4. Are you sure that the remote directory you want to write to is "writable" by your remote user?
  5. Are you sure that your remote server supports SFTP?
  6. Have you tried something simpler then a put? like: print Dumper($sftp->ls('.')); ?
  7. Net::SFTP comes with a sample program called "psftp" that provides an interactive SFTP shell .. you should try using that to send your file once. If that works, then maybe you can dig into it's code to see what it does that you aren't.

In reply to Re: Net::SFTP Help by hossman
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.