Install Perl 5.8.8
[msysgit.git] / mingw / html / lib / Net / protoent.html
blob8bd2cc76af98096e7328ef0f3e8a428b68d38237
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>Net::protoent - by-name interface to Perl's built-in getproto* functions</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:" />
8 </head>
10 <body style="background-color: white">
11 <table border="0" width="100%" cellspacing="0" cellpadding="3">
12 <tr><td class="block" style="background-color: #cccccc" valign="middle">
13 <big><strong><span class="block">&nbsp;Net::protoent - by-name interface to Perl's built-in getproto* functions</span></strong></big>
14 </td></tr>
15 </table>
17 <p><a name="__index__"></a></p>
18 <!-- INDEX BEGIN -->
20 <ul>
22 <li><a href="#name">NAME</a></li>
23 <li><a href="#synopsis">SYNOPSIS</a></li>
24 <li><a href="#description">DESCRIPTION</a></li>
25 <li><a href="#note">NOTE</a></li>
26 <li><a href="#author">AUTHOR</a></li>
27 </ul>
28 <!-- INDEX END -->
30 <hr />
31 <p>
32 </p>
33 <h1><a name="name">NAME</a></h1>
34 <p>Net::protoent - by-name interface to Perl's built-in getproto*() functions</p>
35 <p>
36 </p>
37 <hr />
38 <h1><a name="synopsis">SYNOPSIS</a></h1>
39 <pre>
40 use Net::protoent;
41 $p = getprotobyname(shift || 'tcp') || die &quot;no proto&quot;;
42 printf &quot;proto for %s is %d, aliases are %s\n&quot;,
43 $p-&gt;name, $p-&gt;proto, &quot;@{$p-&gt;aliases}&quot;;</pre>
44 <pre>
45 use Net::protoent qw(:FIELDS);
46 getprotobyname(shift || 'tcp') || die &quot;no proto&quot;;
47 print &quot;proto for $p_name is $p_proto, aliases are @p_aliases\n&quot;;</pre>
48 <p>
49 </p>
50 <hr />
51 <h1><a name="description">DESCRIPTION</a></h1>
52 <p>This module's default exports override the core getprotoent(),
53 getprotobyname(), and <code>getnetbyport()</code> functions, replacing them with
54 versions that return ``Net::protoent'' objects. They take default
55 second arguments of ``tcp''. This object has methods that return the
56 similarly named structure field name from the C's protoent structure
57 from <em>netdb.h</em>; namely name, aliases, and proto. The aliases method
58 returns an array reference, the rest scalars.</p>
59 <p>You may also import all the structure fields directly into your namespace
60 as regular variables using the :FIELDS import tag. (Note that this still
61 overrides your core functions.) Access these fields as variables named
62 with a preceding <code>p_</code>. Thus, <code>$proto_obj-&gt;name()</code> corresponds to
63 $p_name if you import the fields. Array references are available as
64 regular array variables, so for example <code>@{ $proto_obj-&gt;aliases()
65 }</code> would be simply @p_aliases.</p>
66 <p>The <code>getproto()</code> function is a simple front-end that forwards a numeric
67 argument to getprotobyport(), and the rest to getprotobyname().</p>
68 <p>To access this functionality without the core overrides,
69 pass the <a href="file://C|\msysgit\mingw\html/pod/perlfunc.html#item_use"><code>use</code></a> an empty import list, and then access
70 function functions with their full qualified names.
71 On the other hand, the built-ins are still available
72 via the <code>CORE::</code> pseudo-package.</p>
73 <p>
74 </p>
75 <hr />
76 <h1><a name="note">NOTE</a></h1>
77 <p>While this class is currently implemented using the Class::Struct
78 module to build a struct-like class, you shouldn't rely upon this.</p>
79 <p>
80 </p>
81 <hr />
82 <h1><a name="author">AUTHOR</a></h1>
83 <p>Tom Christiansen</p>
84 <table border="0" width="100%" cellspacing="0" cellpadding="3">
85 <tr><td class="block" style="background-color: #cccccc" valign="middle">
86 <big><strong><span class="block">&nbsp;Net::protoent - by-name interface to Perl's built-in getproto* functions</span></strong></big>
87 </td></tr>
88 </table>
90 </body>
92 </html>