Overrides core getgrent
, getgruid
, and getgrnam
functions with versions that return User::grent objects. The object
returned has methods with the same names as the structure fields they
return. That is, to return the field name, use the name
method:
The field names (and therefore the method names) are the same as the names of the fields in the group structure from the C file grp.h: name, passwd, gid, and members (not mem). The first three return scalars, the last an array reference. You can access the fields either with the methods or by importing the fields into your namespace with the :FIELDS import tag and prependinguse User::grent; $gr = getgrgid(0) or die "No group zero"; if ( $gr->name eq 'wheel' && @{$gr->members} > 1 ) { print "gid zero name wheel, with other members"; }
gr_
to the method name (for example, gr_name
).Exports four functions: