home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>Net::protoent - by-name interface to Perl's built-in getproto* functions</TITLE>
- <LINK REL="stylesheet" HREF="../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Net::protoent - by-name interface to Perl's built-in getproto* functions</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#note">NOTE</A></LI>
- <LI><A HREF="#author">AUTHOR</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>Net::protoent - by-name interface to Perl's built-in getproto*() functions</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <PRE>
- 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}";</PRE>
- <PRE>
- use Net::protoent qw(:FIELDS);
- getprotobyname(shift || 'tcp') || die "no proto";
- print "proto for $p_name is $p_proto, aliases are @p_aliases\n";</PRE>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>This module's default exports override the core getprotoent(),
- getprotobyname(), and <CODE>getnetbyport()</CODE> functions, replacing them with
- versions that return ``Net::protoent'' objects. They take default
- second arguments of ``tcp''. This object has methods that return the
- similarly named structure field name from the C's protoent structure
- from <EM>netdb.h</EM>; namely name, aliases, and proto. The aliases method
- returns an array reference, the rest scalars.</P>
- <P>You may also import all the structure fields directly into your namespace
- as regular variables using the :FIELDS import tag. (Note that this still
- overrides your core functions.) Access these fields as variables named
- with a preceding <CODE>p_</CODE>. Thus, <CODE>$proto_obj->name()</CODE> corresponds to
- $p_name if you import the fields. Array references are available as
- regular array variables, so for example <CODE>@{ $proto_obj->aliases()
- }</CODE> would be simply @p_aliases.</P>
- <P>The <CODE>getproto()</CODE> function is a simple front-end that forwards a numeric
- argument to getprotobyport(), and the rest to getprotobyname().</P>
- <P>To access this functionality without the core overrides,
- pass the <A HREF="../../lib/Pod/perlfunc.html#item_use"><CODE>use</CODE></A> an empty import list, and then access
- function functions with their full qualified names.
- On the other hand, the built-ins are still available
- via the <CODE>CORE::</CODE> pseudo-package.</P>
- <P>
- <HR>
- <H1><A NAME="note">NOTE</A></H1>
- <P>While this class is currently implemented using the Class::Struct
- module to build a struct-like class, you shouldn't rely upon this.</P>
- <P>
- <HR>
- <H1><A NAME="author">AUTHOR</A></H1>
- <P>Tom Christiansen</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Net::protoent - by-name interface to Perl's built-in getproto* functions</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-