NAME

Net::NIS::Table - Object Interface to Sun's Network Information Service

DESCRIPTION

The NIS interface comes in two parts. The first part is the raw implementation of the NIS API, described in Net::NIS. The second is the object interface. This document describes the object interface implementation.

The Table object represents an individual NIS map. A NIS map is bound to a Table object with the new method:

$obj = Net::NIS::Table->new($map, [ $domain ]);

For example,

$hostsmap = Net::NIS::Table->new("hosts.byname");

This will create a Table object bound to the hosts.byname NIS map in the default NIS domain. All operations on the $hostsmap object will relate to the hosts.byname map.

You can also specify a non-default domain:

$hostsmap = Net::NIS::Table->new("hosts.byname", "my.domain.com.au");

Once a Table object has been bound to a NIS map, the following methods are available:

$value = $obj->match($key)

Returns the value for a given key. If you only wish to look up one or two values, this function is more efficient, as it retrieves the items one at a time. If you wish to retrieve many items (where many is dependent on the size of the map, and probably what sort of machine you are on), it is better to use the list interface, which uses just one RPC call to retrieve the entire map.

\%data = $obj->list()

Return a reference to an associative array which contains the entire NIS map. The keys in the %data array correspond to the keys in the NIS map. If any error occurs that prevents the retrieval of the map, then the undefined value is returned. In this case, your program can use the status method to determine the cause of the error.

\%data = $obj->search($srchkey)

Return a reference to an associative array which contains all entries that have keys that contain the $srchkey. If any error occurs that prevents the retrieval of the map, then the undefined value is returned. In this case, your program can use the status method to determine the cause of the error.

$status = $obj->status()

Returns the status code for the last operation. If the last operation succeeded, then the status code is 0. The status codes returned by this method are described below in the ERROR CODES section.

$status = $obj->status_string()

Returns the character representation of the status code for the last operation. If the last operation succeeded, then the status code is something like "operation succeeded". The exact strings returned by this function are implementation dependent, and should not be used for comparison purposes. Use the status call, as described above.

ERROR CODES

The status method described above can return one of the following values:

$Net::NIS::ERR_ACCESS		Access violation
$Net::NIS::ERR_BADARGS	Args to function are bad
$Net::NIS::ERR_BADDB		yp data base is bad
$Net::NIS::ERR_BUSY		Database is busy
$Net::NIS::ERR_DOMAIN		Can't bind to a server which serves this domain
$Net::NIS::ERR_KEY		No such key in map
$Net::NIS::ERR_MAP		No such map in server's domain
$Net::NIS::ERR_NODOM		Local domain name not set
$Net::NIS::ERR_PMAP		Can't communicate with portmapper
$Net::NIS::ERR_NOMORE		No more records in map database
$Net::NIS::ERR_RESRC		Local resource allocation failure
$Net::NIS::ERR_RPC		RPC failure
$Net::NIS::ERR_YPBIND		Can't communicate with ypbind
$Net::NIS::ERR_YPERR		Internal yp server or client interface error
$Net::NIS::ERR_YPSERV		Can't communicate with ypserv
$Net::NIS::ERR_VERS		YP version mismatch

AUTHOR

Copyright (c) 1995 Rik Harris (rik.harris@fulcrum.com.au). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The Network Information Service (NIS) was formerly known as Sun Yellow Pages (YP). The functionality of the two remains the same; only the name has changed. The name Yellow Pages is a registered trademark in the United Kingdom of British Telecommunications plc, and may not be used without permission.