Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 8.113 Net::protoentChapter 8
Standard Modules
Next: 8.115 O
 

8.114 Net::servent

Returns information for an Internet service. Overrides the core getservent, getservbyname, and getservbyport functions, replacing them with versions that return Net::servent objects. The functions take a default second argument of tcp. The objects have methods that return the fields of the same name from the servent structure in netdb.h:

FieldDescription
aliasesList of aliases
nameName of service
portPort
protoProtocol to use

You can access the structure fields either with the methods or by importing the fields into your namespace with the :FIELDS import tag and then accessing them by prepending s_ to the field name:

$serv_obj->name()
$s_name


Previous: 8.113 Net::protoentPerl in a NutshellNext: 8.115 O
8.113 Net::protoentBook Index8.115 O

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.