Vahid Moghaddasi wrote:
Hi all,
Hello,
I am trying to modify a korn shell script to Perl to get rid of sed,
awk, etc... For most part I am done but I cant seem to be able to find
an included or CPAN module to lookup NIS maps, such as password,
group.. and also "ypwhich -m"
I will need to get the name of the maps and dump each map one by one.
This is the Korn shell equivalent of what I need in Perl:
automaster=`ypcat auto.master | grep auto | awk '{print $1}'`
maps=`ypwhich -m awk '{print $1}'`
for map in $maps
do
ypcat $map > $tmp/nis.$map
done
http://search.cpan.org/~esm/Net-NIS-0.43/NIS.pod
<QUOTE>
As a special case, the magic map __YPMASTER can be used as an equivalent
to 'ypwhich -m':
tie %ypmaster, 'Net::NIS', '__YPMASTER' or die ...;
printf "ypmaster(passwd) = %s\n", $ypmaster{'passwd.byname'};
print $_, "\n" for sort keys %ypmaster; # Only works on Linux!
Note that keys() only works on Linux, because Linux includes a helpful
yp_maplist() function. On Linux, you can get a list of existing YP maps.
On other OSes, you can't -- but given the name of an existing map,
$ypmaster{$map} will work as expected.
</QUOTE>
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/