NISTable(3pm)

✨ NAME ✨

Net::NIS::Table β€” the Object Interface to Sun's Network Information Service, aka the NISTable(3pm) page, bestie πŸ’–


🌸 DESCRIPTION 🌸

okay so the NIS interface? it comes in two parts, and you need to know about both:

  1. the raw implementation of the NIS API β€” that one lives over in Net::NIS.
  2. the object interface β€” and that's what this whole doc is about. this document describes the object interface implementation. periodt.

So the Table object represents one individual NIS map πŸ—ΊοΈ. A NIS map gets bound to a Table object with the new method:

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

like, for example:

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

that creates a Table object bound to the "hosts.byname" NIS map in the default NIS domain. and every single operation on the $hostsmap object is gonna relate to the "hosts.byname" map. no cap. 🫢

You can also specify a non-default domain, if that's your vibe:

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

Once a Table object has been bound to a NIS map, these methods are available β€” and honestly? they ate. πŸ’…

  • $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, because it retrieves the items one at a time. But if you wish to retrieve many items (and "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. efficiency queen behavior.
  • \%data = $obj->list() β€” returns 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. (we love a diagnostic moment πŸ™ˆ)
  • \%data = $obj->search($srchkey) β€” returns 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. iykyk.
  • $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. like, don't be out here string-matching these, bestie, that's an L. 😭

πŸ’€ 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

sixteen little codes, sixteen little moods πŸŽ€


πŸ‘‘ 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.

and a lil history lesson because it's iconic: 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. 🚫 so don't.

<div align="center">this page is perl v5.42.3, dated 2026-08-19, and lives at NISTable(3pm) β€” go forth and bind your maps, bestie, you're the main character of this domain πŸ¦‹βœ¨πŸ’œ</div>

πŸ“¦ where this page comes from