MAN page from RedHat Other perl-5.004-0.1.i386.rpm
Net::protoent
Section: Perl Programmers Reference Guide (3)
Updated: perl 5.004, patch 04
Index NAME
Net::protoent - by-name interface to Perl's built-in getproto*() functions
SYNOPSIS
use Net::protoent; $p = getprotobyname(shift || 'tcp') || die "no proto"; printf "proto for %s is %d, aliases are %s\n", $p->name, $p->proto, "@{$p->aliases}"; use Net::protoent qw(:FIELDS); getprotobyname(shift || 'tcp') || die "no proto"; print "proto for $p_name is $p_proto, aliases are @p_aliases\n";
DESCRIPTION
This module's default exports override the core
getprotoent(),
getprotobyname(), and
getnetbyport() functions, replacing them withversions that return ``Net::protoent'' objects. They take defaultsecond arguments of ``tcp''. This object has methods that return thesimilarly named structure field name from the C's protoent structurefrom
netdb.h; namely name, aliases, and proto. The aliases methodreturns an array reference, the rest scalars.
You may also import all the structure fields directly into your namespaceas regular variables using the :FIELDS import tag. (Note that this stilloverrides your core functions.) Access these fields as variables namedwith a preceding p_. Thus, $proto_obj->name() corresponds to$p_name if you import the fields. Array references are available asregular array variables, so for example @{ $proto_obj->aliases()} would be simply @p_aliases.
The getproto() function is a simple front-end that forwards a numericargument to getprotobyport(), and the rest to getprotobyname().
To access this functionality without the core overrides,pass the use an empty import list, and then accessfunction functions with their full qualified names.On the other hand, the built-ins are still availablevia the CORE:: pseudo-package.
NOTE
While this class is currently implemented using the Class::Structmodule to build a struct-like class, you shouldn't rely upon this.
AUTHOR
Tom Christiansen
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- NOTE
- AUTHOR
This document was created byman2html,using the manual pages.