It's hard to say what the correct way is. getpwnam returns the
password structure (and that's different things on different *Nixes but
basically user name, user id, group id, encrypted password, real name,
home directory, and shell). Exactly what do you need for your script?
The only place it's called is in the following subroutine:
sub map_user_group
{
if( ! defined( $uid ) ){
if( $user =~ /^\d+$/ ){
# User is just a number - presume it is the uid
$uid = $user;
}
else {
$uid = (getpwnam( $user ))[ 2 ];
}
}
if( ! defined( $gid ) ){
if( $group =~ /\d+$/ ){
# Group is just a number - presume it is the gid
$gid = $group;
}
else {
$gid = (getgrnam( $group ))[ 2 ];
}
}
}
that snippet of code sets the userid and groupid ... concepts that
are foreign to a lot of windows systems. It's not so much that
ActivePerl doesn't implement getpwnam (and getgrnam) but that
there's no need for it on a windows platform. Exactly what is the
script doing with $uid and $gid?