I know the original question was posted back in 2007, but I'm still finding other Perl forums with a similar question. I just came across this very same problem with Perl 5.8.9 for WIndows from ActiveState. Previous answers in the comments are correct, but perhaps not entirely clear to some programmers (please refrain from follow up comments about real programmers, etc). To help others with this problem today and in the future, here is exactly what I did.

Near the top of my script I added the suggested ENV line:

$ENV(HOME) = "C:\\Perl\\myscripts\\etc";

This setting tells the script where to save your SHH settings. Run your script after that, and assuming no other problems are present, you'll see a directory named .shh in the directory you specified with the $ENV(HOME) setting. Look in that directory and you should find a file named something like known_hosts2. If you have all that, then you've solved the getpwuid function problem (and a few other related problems I'm guessing).

After setting that variable I was able to connect to an SFTP server and download a small file; however, the Net-Sftp page on cpan says that when you call "get" to retrieve a file that the $localfile setting is optional. I found that was not the case. I had to spell out completely the remote file I wanted and what I wanted to call it once it downloaded. Here's an example:

$remotefile = '/home/joe_user/addresses.txt'; $localfile = "C:\\temp\\addresses.txt"; $sftp->get($remotefile, $localfile);

When I didn't include the $localfile setting, I didn't get anything. Actually, I downloaded the file but it was never saved to any place I could fine. I know that was a simple illustration for most of the experienced Perl programmers that frequent this forum; however, for the casual Perl programmer, I probably just saved them a big headache. Enjoy and thanks to the previous comments that contained the solution. I only posted to add further clarity in hopes to help out others.


In reply to Re: The getpwuid function is unimplemented at C:/Perl/.... by Anonymous Monk
in thread The getpwuid function is unimplemented at C:/Perl/.... by blackadder

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.