Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

The getpwuid function is unimplemented at C:/Perl/....

by blackadder (Hermit)
on May 03, 2007 at 14:53 UTC ( [id://613393] : perlquestion . print w/replies, xml ) Need Help??

blackadder has asked for the wisdom of the Perl Monks concerning the following question:

Most Highly Revered Monks,...Utmost Greetings indeed

O gorgeous ones, please help me. I have this script
#! c:/perl/bin/perl.exe use strict; use Net::SSH::Perl; my $host = 'VM701'; my $user = 'root'; my $pass = 'thepass'; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my ($stdout, $stderr, $exit) = $ssh->cmd('ls -l'); $ssh->close;
and I get this error
The getpwuid function is unimplemented at C:/Perl/site/lib/Net/SSH/Per +l.pm line 110.
My questions is: how do/can I get rid of this error? i.e. how do I implement the getpwuid thing?

basically what I am trying to do is :

1- Connect to a Linux Server from my windows BOX.

2- Cd to etc\mydir .

3- Read all files in that directory and capture all file that begin with the word Lic* .

4- Open the File and copy the contents to an external file.

Sounds simple, but like all simple things..its NOT! Well not for me anyway.

Now my Linux server only supports SSH by the way, So I guess I am stuck with module.

I did few searchs here for the above error but got none the wiser!

Thanks for your help ************************UPDATE************************

I tried it with Net::SSH and got the same error!

VERY SORRY, I WAS JUST BEING AN IDIOT,..PLEASE IGNORE THIS POST.......THANK YOU VERY MUCH
Blackadder

Replies are listed 'Best First'.
Re: The getpwuid function is unimplemented at C:/Perl/....
by Joost (Canon) on May 03, 2007 at 15:04 UTC
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: The getpwuid function is unimplemented at C:/Perl/....
by Anonymous Monk on Jan 18, 2011 at 20:23 UTC
    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.