Perl has several built-in functions for accessing / etc / passwd on Unix systems (and elsewhere, when supported) for user and group information. For instance,
my $name = getpwuid($uid);
will return the username based on the user ID or undef if there is no such user.
If a Perl script needs to be portable and run on Unices and Windows, how do I access user and group information? ActivePerl seems to support the User :: grent and User :: pwent modules, which provide access to / etc / passwd by field, even on Windows. Curiously, they do not support the getpw * and getgr * built-in functions. What other alternatives are there?
Ville koskinen
source share