The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

colnames

colnames returns the column headings for the NIS+ table. If called in an array context, it returns an array containing the column names in the order in which they appear in the table. If called in a scalar context, it returns a reference to a hash with keys being column names, and values being an integer representing the column's position.

e.g.

$table = Net::NISPlus::Table('hosts.org_dir'); $cols = $table->colnames;

will end up with $cols being:

$cols->{'cname'} = 0; $cols->{'name'} = 1; $cols->{'addr'} = 2; $cols->{'comment'} = 3;

and

$table = Net::NISPlus::Table('hosts.org_dir'); @cols = $table->colnames;

will end up with @cols being:

@cols = ('cname', 'name', 'addr', 'comment')

NOTE: as the colnames method behaves differently depending on what context it is called in, it may not always behave as you expect. For example, the following two code fragments are not equivalent:

my($colnames) = $table->colnames;

and

my($colnames); $colnames = $table->colnames;

The first calls colnames in an array context, and the second in a scalar context.

add

Add an entry to the table. Any columns not specified will be set to null strings.

$table->add('key1' => 'value1', 'key2' => 'value2');

or

$table->add(['key1' => 'key1', 'key2' => 'value2'], ['key1' => 'key3', 'key2' => 'value4'])

addinfo

Add an entry to the table, setting the info variable as we go. Any columns not specified will be set to null strings.

$table->addinfo([key1, key2], ['values' => [ 'value1', 'value2' ], 'access' => access, 'domain' => domain, 'owner' => owner, 'group' => group], [...])

remove

Remove a single entry from the table. If the key/value pairs match more that one entry, an error occurs, and no entries are removed. Use removem to remove multiple entries with a single command.

$table->remove({'key1' => 'value1', 'key2' => 'value2'});

or

$table->remove("[key1=value1,key2=value2]");

If you specify the table name in the indexed name form, it will be removed and replaced with the full name determined when the table object was created (and accessible with $table->fullName);

removem

Remove one or more entries from the table. All entries which match the key/value pairs will be removed. Use remove to remove a single entry.

$table->removem({'key1' => 'value1', 'key2' => 'value2'});

or

$table->removem("[key1=value1,key2=value2]");

If you specify the table name in the indexed name form, it will be removed and replaced with the full name determined when the table object was created (and accessible with $table->fullName);

clear

Remove all entries from the table

$table->clear();

modify

Change fields in a table entry.

$table->modify({'key1' => 'value1', 'key2' => 'value2'}, {'key3' => 'newvalue3'});

or

$table->modify("[key1=value1,key2=value2]", {'key3' => 'newvalue3'});

If you specify the table name in the indexed name form, it will be removed and replaced with the full name determined when the table object was created (and accessible with $table->fullName);

first_entry

first_entry retrieves the first entry in the table. Data is returned in an array.

@fields = $table->first_entry();

next_entry

next_entry successively returns the next entry in the table. first_entry should be called before next_entry. Data is returned in an array.

@fields = $table->next_entry();

isColname

returns TRUE if the given argument is a valid column name for the table

$table->isColname("name");