nntp.html
来自「perl教程」· HTML 代码 · 共 605 行 · 第 1/2 页
HTML
605 行
<p>If <code>MESSAGE</code> is not specified then the message must be sent using the
<code>datasend</code> and <code>dataend</code> methods from <a href="../../lib/Net/Cmd.html">the Net::Cmd manpage</a></p>
</dd>
<dd>
<p><code>MESSAGE</code> can be either an array of lines or a reference to an array.</p>
</dd>
<dd>
<p>The message, either sent via <code>datasend</code> or as the <code>MESSAGE</code>
parameter, must be in the format as described by RFC822 and must
contain From:, Newsgroups: and Subject: headers.</p>
</dd>
</li>
<dt><strong><a name="item_postfh">postfh ()</a></strong>
<dd>
<p>Post a new article to the news server using a tied filehandle. If
posting is allowed, this method will return a tied filehandle that you
can <a href="../../lib/Pod/perlfunc.html#item_print"><code>print()</code></a> the contents of the article to be posted. You must
explicitly <a href="../../lib/Pod/perlfunc.html#item_close"><code>close()</code></a> the filehandle when you are finished posting the
article, and the return value from the <a href="../../lib/Pod/perlfunc.html#item_close"><code>close()</code></a> call will indicate
whether the message was successfully posted.</p>
</dd>
</li>
<dt><strong><a name="item_slave">slave ()</a></strong>
<dd>
<p>Tell the remote server that I am not a user client, but probably another
news server.</p>
</dd>
</li>
<dt><strong><a name="item_quit">quit ()</a></strong>
<dd>
<p>Quit the remote server and close the socket connection.</p>
</dd>
</li>
</dl>
<p>
</p>
<h2><a name="extension_methods">Extension methods</a></h2>
<p>These methods use commands that are not part of the RFC977 documentation. Some
servers may not support all of them.</p>
<dl>
<dt><strong><a name="item_newsgroups">newsgroups ( [ PATTERN ] )</a></strong>
<dd>
<p>Returns a reference to a hash where the keys are all the group names which
match <a href="#item_pattern"><code>PATTERN</code></a>, or all of the groups if no pattern is specified, and
each value contains the description text for the group.</p>
</dd>
</li>
<dt><strong><a name="item_distributions">distributions ()</a></strong>
<dd>
<p>Returns a reference to a hash where the keys are all the possible
distribution names and the values are the distribution descriptions.</p>
</dd>
</li>
<dt><strong><a name="item_subscriptions">subscriptions ()</a></strong>
<dd>
<p>Returns a reference to a list which contains a list of groups which
are recommended for a new user to subscribe to.</p>
</dd>
</li>
<dt><strong><a name="item_overview_fmt">overview_fmt ()</a></strong>
<dd>
<p>Returns a reference to an array which contain the names of the fields returned
by <a href="#item_xover"><code>xover</code></a>.</p>
</dd>
</li>
<dt><strong><a name="item_active_times">active_times ()</a></strong>
<dd>
<p>Returns a reference to a hash where the keys are the group names and each
value is a reference to an array containing the time the groups was created
and an identifier, possibly an Email address, of the creator.</p>
</dd>
</li>
<dt><strong><a name="item_active">active ( [ PATTERN ] )</a></strong>
<dd>
<p>Similar to <a href="#item_list"><code>list</code></a> but only active groups that match the pattern are returned.
<a href="#item_pattern"><code>PATTERN</code></a> can be a group pattern.</p>
</dd>
</li>
<dt><strong><a name="item_xgtitle">xgtitle ( PATTERN )</a></strong>
<dd>
<p>Returns a reference to a hash where the keys are all the group names which
match <a href="#item_pattern"><code>PATTERN</code></a> and each value is the description text for the group.</p>
</dd>
</li>
<dt><strong><a name="item_xhdr">xhdr ( HEADER, MESSAGE-SPEC )</a></strong>
<dd>
<p>Obtain the header field <code>HEADER</code> for all the messages specified.</p>
</dd>
<dd>
<p>The return value will be a reference
to a hash where the keys are the message numbers and each value contains
the text of the requested header for that message.</p>
</dd>
</li>
<dt><strong><a name="item_xover">xover ( MESSAGE-SPEC )</a></strong>
<dd>
<p>The return value will be a reference
to a hash where the keys are the message numbers and each value contains
a reference to an array which contains the overview fields for that
message.</p>
</dd>
<dd>
<p>The names of the fields can be obtained by calling <a href="#item_overview_fmt"><code>overview_fmt</code></a>.</p>
</dd>
</li>
<dt><strong><a name="item_xpath">xpath ( MESSAGE-ID )</a></strong>
<dd>
<p>Returns the path name to the file on the server which contains the specified
message.</p>
</dd>
</li>
<dt><strong><a name="item_xpat">xpat ( HEADER, PATTERN, MESSAGE-SPEC)</a></strong>
<dd>
<p>The result is the same as <a href="#item_xhdr"><code>xhdr</code></a> except the is will be restricted to
headers where the text of the header matches <a href="#item_pattern"><code>PATTERN</code></a></p>
</dd>
</li>
<dt><strong><a name="item_xrover">xrover</a></strong>
<dd>
<p>The XROVER command returns reference information for the <a href="#item_article"><code>article(s)</code></a>
specified.</p>
</dd>
<dd>
<p>Returns a reference to a HASH where the keys are the message numbers and the
values are the References: lines from the articles</p>
</dd>
</li>
<dt><strong><a name="item_listgroup">listgroup ( [ GROUP ] )</a></strong>
<dd>
<p>Returns a reference to a list of all the active messages in <code>GROUP</code>, or
the current group if <code>GROUP</code> is not specified.</p>
</dd>
</li>
<dt><strong><a name="item_reader">reader</a></strong>
<dd>
<p>Tell the server that you are a reader and not another server.</p>
</dd>
<dd>
<p>This is required by some servers. For example if you are connecting to
an INN server and you have transfer permission your connection will
be connected to the transfer daemon, not the NNTP daemon. Issuing
this command will cause the transfer daemon to hand over control
to the NNTP daemon.</p>
</dd>
<dd>
<p>Some servers do not understand this command, but issuing it and ignoring
the response is harmless.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="unsupported">UNSUPPORTED</a></h1>
<p>The following NNTP command are unsupported by the package, and there are
no plans to do so.</p>
<pre>
AUTHINFO GENERIC
XTHREAD
XSEARCH
XINDEX</pre>
<p>
</p>
<hr />
<h1><a name="definitions">DEFINITIONS</a></h1>
<dl>
<dt><strong><a name="item_message_2dspec">MESSAGE-SPEC</a></strong>
<dd>
<p><a href="#item_message_2dspec"><code>MESSAGE-SPEC</code></a> is either a single message-id, a single message number, or
a reference to a list of two message numbers.</p>
</dd>
<dd>
<p>If <a href="#item_message_2dspec"><code>MESSAGE-SPEC</code></a> is a reference to a list of two message numbers and the
second number in a range is less than or equal to the first then the range
represents all messages in the group after the first message number.</p>
</dd>
<dd>
<p><strong>NOTE</strong> For compatibility reasons only with earlier versions of Net::NNTP
a message spec can be passed as a list of two numbers, this is deprecated
and a reference to the list should now be passed</p>
</dd>
</li>
<dt><strong><a name="item_pattern">PATTERN</a></strong>
<dd>
<p>The <code>NNTP</code> protocol uses the <code>WILDMAT</code> format for patterns.
The WILDMAT format was first developed by Rich Salz based on
the format used in the UNIX "find" command to articulate
file names. It was developed to provide a uniform mechanism
for matching patterns in the same manner that the UNIX shell
matches filenames.</p>
</dd>
<dd>
<p>Patterns are implicitly anchored at the
beginning and end of each string when testing for a match.</p>
</dd>
<dd>
<p>There are five pattern matching operations other than a strict
one-to-one match between the pattern and the source to be
checked for a match.</p>
</dd>
<dd>
<p>The first is an asterisk <code>*</code> to match any sequence of zero or more
characters.</p>
</dd>
<dd>
<p>The second is a question mark <code>?</code> to match any single character. The
third specifies a specific set of characters.</p>
</dd>
<dd>
<p>The set is specified as a list of characters, or as a range of characters
where the beginning and end of the range are separated by a minus (or dash)
character, or as any combination of lists and ranges. The dash can
also be included in the set as a character it if is the beginning
or end of the set. This set is enclosed in square brackets. The
close square bracket <code>]</code> may be used in a set if it is the first
character in the set.</p>
</dd>
<dd>
<p>The fourth operation is the same as the
logical not of the third operation and is specified the same
way as the third with the addition of a caret character <code>^</code> at
the beginning of the test string just inside the open square
bracket.</p>
</dd>
<dd>
<p>The final operation uses the backslash character to
invalidate the special meaning of an open square bracket <code>[</code>,
the asterisk, backslash or the question mark. Two backslashes in
sequence will result in the evaluation of the backslash as a
character with no special meaning.</p>
</dd>
<dl>
<dt><strong><a name="item_examples">Examples</a></strong>
<dt><strong><a name="item__5b_5e_5d_2d_5d"><code>[^]-]</code></a></strong>
<dd>
<p>matches any single character other than a close square
bracket or a minus sign/dash.</p>
</dd>
</li>
<li>
<p>matches any string that ends with the string "bdc"
including the string "bdc" (without quotes).</p>
</li>
<dt><strong><a name="item__5b0_2d9a_2dza_2dz_5d"><code>[0-9a-zA-Z]</code></a></strong>
<dd>
<p>matches any single printable alphanumeric ASCII character.</p>
</dd>
</li>
<dt><strong><a name="item_a_3f_3fd"><code>a??d</code></a></strong>
<dd>
<p>matches any four character string which begins
with a and ends with d.</p>
</dd>
</li>
</dl>
</dl>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><a href="../../lib/Net/Cmd.html">the Net::Cmd manpage</a></p>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Graham Barr <<a href="mailto:gbarr@pobox.com">gbarr@pobox.com</a>></p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright (c) 1995-1997 Graham Barr. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.</p>
<hr><p><em>$Id: //depot/libnet/Net/NNTP.pm#18 $</em></p>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?