NAME
Net::NIS::Netgroup - Interface to glibc "getdomainname" function and its family
VERSION
Version 1.1
SYNOPSIS
use Net::NIS::Netgroup;
printf("Domain name is %s\n", getdomainname());
setdomainname("newdom.com");
printf("Is user in group? %d\n",
innetgr('netgroup', 'host', 'user', 'domain'));
my @result = listnetgr("some-netgroup");
foreach my $r (@result) {
printf("Found entry (%s, %s, %s)\n",
$r->{host}, $r->{user}, $->{domain});
}
#
# Return string representations instead of hashes: 2nd arg true
#
my @result2 = listnetgr("some-netgroup", 1);
foreach my $r (@result2) {
printf("Found entry %s\n", $r);
}
DESCRIPTION
This module provides access methods for net groups. The following functions are offered:
getdomainname()
setdomainname($domain)
innetgr($group, $host, $user, $domain)
listnetgr($group [, $bool])
Detailed information about the three functions getgroupname
, setdomainname
, and innetgr
can be found on the man pages of the respective glibc functions.
innetgr
will happily take "undef" for one or more of its arguments, representing the same as a NULL pointer in the C equivalent.
The function listnetgr($group [, $bool])
uses the functions setnetgrent
, getnetgrent
, and endnetgrent
to iterate over the members of a net group, returning a list of hash references
{
host => $host,
user => $user,
domain => $domain
}
for all found elements. If the (optional) second argument to listnetgr
is a true value, string representations (host,user,domain)
of all entries are returned.
EXPORTED FUNCTIONS
All functions are exported per default. Use
use Net::Nis::Netgroup ();
to not import the provided symbols.