NISPlus
view release on metacpan or search on metacpan
#!/usr/local/bin/perl -w
#BEGIN { unshift(@INC, "../blib/lib", "./blib/lib", "../blib/arch"); }
use Net::NISPlus::Directory;
use Net::NISPlus::Table;
use Getopt::Std;
# OPTIONS
#
# -A Display the data within the table and all of the data in tables in
# the initial table's concatenation path.
#
# -h Display the header line prior to displaying the table. The
# header consists of the `#' (hash) character followed by the name of
# each column. The column names are separated by the table separator
# character.
#
# -L Follow links. When this option is specified, if tablename or name
# names a LINK type object, the link is followed and the object or table
# named by the link is displayed.
#
# -M Master server only. This option specifies that the request should
# be sent to the master server of the named data. This guarantees that
# the most up-to-date information is seen at the possible expense
# of increasing the load on the master server and increasing the
# possibility of the NIS+ server being unavailable or busy for updates.
#
# -P Follow concatenation path. This option specifies that the request
# should follow the concatenation path of a table if the initial search
# is unsuccessful. This option is only useful when using an indexed
# name for name and the -o option.
#
# -v Display binary data directly. This option displays columns
# containing binary data on the standard output. Without this option
# binary data is displayed as the string *BINARY*.
#
# -o name
# Display the internal representation of the named NIS+
# object(s). If name is an indexed name (see nismatch(1)), then each
# of the matching entry objects is displayed. This option is used to
# display access rights and other attributes of individual columns.
$usage="niscat [ -AhLMv ] tablename\nniscat [ -ALMP ] -o name ...\n";
getopts("DAhLMPvo");
if (($opt_h || $opt_v) && ($opt_P || $opt_o)) { die $usage; };
chop($os=`uname -r`);
$style = 1 if $os eq "5.3";
$style = 1 if $os eq "5.4";
$style = 2 if $os eq "5.5";
$style = 2 if $os eq "5.5.1";
print "#ARGV = $#ARGV\n" if $opt_D;
print "os = $os\n" if $opt_D;
foreach $tname (@ARGV)
{
if ($opt_o)
{
if (Net::NISPlus::type($tname) eq "TABLE")
{
$table = Net::NISPlus::Table->new("$tname");
print "table = $table\n" if $opt_D;
if ($table)
{
# $table->set('master_only', 1) if $opt_M;
# $table->set('binary', 1) if $opt_v;
# $table->set('follow_links', 1) if $opt_L;
$info = $table->info();
common($info);
print "Table Type : $info->{'ta_type'}\n";
print "Number of Columns : $info->{'ta_maxcol'}\n";
print "Character Separator : $info->{'ta_sep'}\n";
print "Search Path : $info->{'ta_path'}\n";
print "Columns :\n";
@cols = @{$info->{'ta_cols'}};
foreach $col ($[..$#cols)
{
print "\t[$col]\tName : $cols[$col]\n";
print "\t\tAttributes : ",
Net::NISPlus::flags2str($info->{'ta_cols_flags'}->{$cols[$col]}),
"\n";
print "\t\tAccess Rights : ",
( run in 0.936 second using v1.01-cache-2.11-cpan-5a3173703d6 )