http://qs1969.pair.com?node_id=170697

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

hello all, i'm making the attempt to get a script i've written fully compatible with the win32 platform. i'm running active state perl Perl v5.6.1 , binary build 631

right off the bat, i am running into problems. my script makes a call to getpwuid to place the value into a variable

## pull as global for filename comments my $user = getpwuid($<);

however, this produces the following error

'The getpwuid function is unimplemented at pancho line 184.'

i checked over on Active State's website and in their docs section, they make a reference to the entire getpw group. it certainly seems as though the fuction is available to the distribution.

has anyone encountered this? is my code incorrect for a win32 platform (Win2k)?

humbly -c

Replies are listed 'Best First'.
Re: getpwuid absent from Active State Perl?
by particle (Vicar) on May 31, 2002 at 13:52 UTC
    the answer is in their docs as well. look under FUNCTION IMPLEMENTATIONS. perlport is the best place to look if you want to make sure your code is portable.

    ~Particle *accelerates*

Re: getpwuid absent from Active State Perl?
by vkonovalov (Monk) on May 31, 2002 at 16:19 UTC
    if you're on Win32 and not Cygwin (which *does* have getpwuid and on Win32), then it's probably better to try using 'getlogin' function, may be optionally checking for $^O to be equal to 'Win32'.
    Vadim