Net::NNTP - Online Linux Manual PageSection : 3
Updated : 2023-03-21
Source : perl v5.36.0
Note : User Contributed Perl Documentation

NAMENet::NNTP − NNTP Client class

SYNOPSIS​ use Net::NNTP; ​ ​ $nntp = Net::NNTP−>new("some.host.name"); ​ $nntp−>quit; ​ ​ # start with SSL, e.g. nntps ​ $nntp = Net::NNTP−>new("some.host.name", SSL => 1); ​ ​ # start with plain and upgrade to SSL ​ $nntp = Net::NNTP−>new("some.host.name"); ​ $nntp−>starttls;

DESCRIPTION\*(C`Net::NNTP\*(C'\fR is a class implementing a simple NNTP client in Perl as described in RFC977 and RFC4642. With IO::Socket::SSL installed it also provides support for implicit and explicit TLS encryption, i.e. NNTPS or NNTP+STARTTLS. The Net::NNTP class is a subclass of Net::Cmd and (depending on avaibility) of IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET.

Class Methodsnew([$host][, %options]) This is the constructor for a new Net::NNTP object. $host is the name of the remote host to which a NNTP connection is required. If not given then it may be passed as the \*(C`Host\*(C'\fR option described below. If no host is passed then two environment variables are checked, first \*(C`NNTPSERVER\*(C'\fR then ​\*(C`NEWSHOST\*(C'\fR, then \f(CW\*(C`Net::Config\*(C'\fR is checked, and if a host is not found then \*(C`news\*(C'\fR is used. %options are passed in a hash like fashion, using key and value pairs. Possible options are: Host − NNTP host to connect to. It may be a single scalar, as defined for the \*(C`PeerAddr\*(C'\fR option in IO::Socket::INET, or a reference to an array with hosts to try in turn. The "host" method will return the value which was used to connect to the host. Port − port to connect to. Default − 119 for plain NNTP and 563 for immediate SSL (nntps). SSL − If the connection should be done from start with SSL, contrary to later upgrade with \*(C`starttls\*(C'\fR. You can use SSL arguments as documented in IO::Socket::SSL, but it will usually use the right arguments already. Timeout − Maximum time, in seconds, to wait for a response from the NNTP server, a value of zero will cause all IO operations to block. (default: 120) Debug − Enable the printing of debugging information to STDERR Reader − If the remote server is INN then initially the connection will be to innd, by default \*(C`Net::NNTP\*(C'\fR will issue a \f(CW\*(C`MODE READER\*(C'\fR command so that the remote server becomes nnrpd. If the \*(C`Reader\*(C'\fR option is given with a value of zero, then this command will not be sent and the connection will be left talking to innd. LocalAddr and LocalPort − These parameters are passed directly to IO::Socket to allow binding the socket to a specific local address and port. Domain − This parameter is passed directly to IO::Socket and makes it possible to enforce IPv4 connections even if IO::Socket::IP is used as super class. Alternatively Family can be used.

Object MethodsUnless otherwise stated all methods return either a true or false value, with true meaning that the operation was a success. When a method states that it returns a value, failure will be returned as undef or an empty list. \*(C`Net::NNTP\*(C'\fR inherits from \f(CW\*(C`Net::Cmd\*(C'\fR so methods defined in \f(CW\*(C`Net::Cmd\*(C'\fR may be used to send commands to the remote NNTP server in addition to the methods documented here. host() Returns the value used by the constructor, and passed to IO::Socket::INET, to connect to the host. starttls() Upgrade existing plain connection to SSL. Any arguments necessary for SSL must be given in \*(C`new\*(C'\fR already. article([{$msgid|$msgnum}[, $fh]]) Retrieve the header, a blank line, then the body (text) of the specified article. If $fh is specified then it is expected to be a valid filehandle and the result will be printed to it, on success a true value will be returned. If $fh is not specified then the return value, on success, will be a reference to an array containing the article requested, each entry in the array will contain one line of the article. If no arguments are passed then the current article in the currently selected newsgroup is fetched. $msgnum is a numeric id of an article in the current newsgroup, and will change the current article pointer. $msgid is the message id of an article as shown in that article's header. It is anticipated that the client will obtain the $msgid from a list provided by the \*(C`newnews\*(C'\fR command, from references contained within another article, or from the message-id provided in the response to some other commands. If there is an error then \*(C`undef\*(C'\fR will be returned. body([{$msgid|$msgnum}[, [$fh]]) Like \*(C`article\*(C'\fR but only fetches the body of the article. head([{$msgid|$msgnum}[, [$fh]]) Like \*(C`article\*(C'\fR but only fetches the headers for the article. articlefh([{$msgid|$msgnum}]) bodyfh([{$msgid|$msgnum}]) headfh([{$msgid|$msgnum}]) These are similar to article(), body() and head(), but rather than returning the requested data directly, they return a tied filehandle from which to read the article. nntpstat([{$msgid|$msgnum}]) The \*(C`nntpstat\*(C'\fR command is similar to the \f(CW\*(C`article\*(C'\fR command except that no text is returned. When selecting by message number within a group, the \*(C`nntpstat\*(C'\fR command serves to set the "current article pointer" without sending text. Using the \*(C`nntpstat\*(C'\fR command to select by message-id is valid but of questionable value, since a selection by message-id does not alter the "current article pointer". Returns the message-id of the "current article". group([$group]) Set and/or get the current group. If $group is not given then information is returned on the current group. In a scalar context it returns the group name. In an array context the return value is a list containing, the number of articles in the group, the number of the first article, the number of the last article and the group name. help() Request help text (a short summary of commands that are understood by this implementation) from the server. Returns the text or undef upon failure. ihave($msgid[, $message]) The \*(C`ihave\*(C'\fR command informs the server that the client has an article whose id is $msgid. If the server desires a copy of that article and $message has been given then it will be sent. Returns true if the server desires the article and $message was successfully sent, if specified. If $message is not specified then the message must be sent using the ​\*(C`datasend\*(C'\fR and \f(CW\*(C`dataend\*(C'\fR methods from Net::Cmd $message can be either an array of lines or a reference to an array and must be encoded by the caller to octets of whatever encoding is required, e.g. by using the Encode module's encode() function. last() Set the "current article pointer" to the previous article in the current newsgroup. Returns the message-id of the article. date() Returns the date on the remote server. This date will be in a UNIX time format (seconds since 1970) postok() \*(C`postok\*(C'\fR will return \fItrue\fR if the servers initial response indicated that it will allow posting. authinfo($user, $pass) Authenticates to the server (using the original AUTHINFO USER / AUTHINFO PASS form, defined in RFC2980) using the supplied username and password. Please note that the password is sent in clear text to the server. This command should not be used with valuable passwords unless the connection to the server is somehow protected. authinfo_simple($user, $pass) Authenticates to the server (using the proposed NNTP V2 AUTHINFO SIMPLE form, defined and deprecated in RFC2980) using the supplied username and password. As with "authinfo" the password is sent in clear text. list() Obtain information about all the active newsgroups. The results is a reference to a hash where the key is a group name and each value is a reference to an array. The elements in this array are:− the last article number in the group, the first article number in the group and any information flags about the group. newgroups($since[, $distributions]) $since is a time value and $distributions is either a distribution pattern or a reference to a list of distribution patterns. The result is the same as \*(C`list\*(C'\fR, but the groups return will be limited to those created after $since and, if specified, in one of the distribution areas in $distributions. newnews($since[, $groups[, $distributions]]) $since is a time value. $groups is either a group pattern or a reference to a list of group patterns. $distributions is either a distribution pattern or a reference to a list of distribution patterns. Returns a reference to a list which contains the message-ids of all news posted after $since, that are in a groups which matched $groups and a distribution which matches $distributions. next() Set the "current article pointer" to the next article in the current newsgroup. Returns the message-id of the article. post([$message]) Post a new article to the news server. If $message is specified and posting is allowed then the message will be sent. If $message is not specified then the message must be sent using the ​\*(C`datasend\*(C'\fR and \f(CW\*(C`dataend\*(C'\fR methods from Net::Cmd $message can be either an array of lines or a reference to an array and must be encoded by the caller to octets of whatever encoding is required, e.g. by using the Encode module's encode() function. The message, either sent via \*(C`datasend\*(C'\fR or as the \f(CW$message\fR parameter, must be in the format as described by RFC822 and must contain From:, Newsgroups: and Subject: headers. postfh() 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 print() the contents of the article to be posted. You must explicitly close() the filehandle when you are finished posting the article, and the return value from the close() call will indicate whether the message was successfully posted. slave() Tell the remote server that I am not a user client, but probably another news server. quit() Quit the remote server and close the socket connection. can_inet6() Returns whether we can use IPv6. can_ssl() Returns whether we can use SSL.

Extension MethodsThese methods use commands that are not part of the RFC977 documentation. Some servers may not support all of them. newsgroups([$pattern]) Returns a reference to a hash where the keys are all the group names which match $pattern, or all of the groups if no pattern is specified, and each value contains the description text for the group. distributions() Returns a reference to a hash where the keys are all the possible distribution names and the values are the distribution descriptions. distribution_patterns() Returns a reference to an array where each element, itself an array reference, consists of the three fields of a line of the distrib.pats list maintained by some NNTP servers, namely: a weight, a wildmat and a value which the client may use to construct a Distribution header. subscriptions() Returns a reference to a list which contains a list of groups which are recommended for a new user to subscribe to. overview_fmt() Returns a reference to an array which contain the names of the fields returned by \*(C`xover\*(C'\fR. active_times() 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. active([$pattern]) Similar to \*(C`list\*(C'\fR but only active groups that match the pattern are returned. ​$pattern can be a group pattern. xgtitle($pattern) Returns a reference to a hash where the keys are all the group names which match $pattern and each value is the description text for the group. xhdr($header, $message_spec) Obtain the header field $header for all the messages specified. 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. xover($message_spec) 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. The names of the fields can be obtained by calling \*(C`overview_fmt\*(C'\fR. xpath($message_id) Returns the path name to the file on the server which contains the specified message. xpat($header, $pattern, $message_spec) The result is the same as \*(C`xhdr\*(C'\fR except the is will be restricted to headers where the text of the header matches $pattern xrover($message_spec) The XROVER command returns reference information for the article(s) specified. Returns a reference to a HASH where the keys are the message numbers and the values are the References: lines from the articles listgroup([$group]) Returns a reference to a list of all the active messages in $group, or the current group if $group is not specified. reader() Tell the server that you are a reader and not another server. 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. Some servers do not understand this command, but issuing it and ignoring the response is harmless.

UnsupportedThe following NNTP command are unsupported by the package, and there are no plans to do so. ​ AUTHINFO GENERIC ​ XTHREAD ​ XSEARCH ​ XINDEX

Definitions$message_spec $message_spec is either a single message-id, a single message number, or a reference to a list of two message numbers. If $message_spec 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. NOTE 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 $pattern The \*(C`NNTP\*(C'\fR protocol uses the \f(CW\*(C`WILDMAT\*(C'\fR 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. Patterns are implicitly anchored at the beginning and end of each string when testing for a match. 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. The first is an asterisk \*(C`*\*(C'\fR to match any sequence of zero or more characters. The second is a question mark \*(C`?\*(C'\fR to match any single character. The third specifies a specific set of characters. 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 \*(C`]\*(C'\fR may be used in a set if it is the first character in the set. 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 \*(C`^\*(C'\fR at the beginning of the test string just inside the open square bracket. The final operation uses the backslash character to invalidate the special meaning of an open square bracket \*(C`[\*(C'\fR, 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. Examples [^]] matches any single character other than a close square bracket or a minus sign/dash. *bdc matches any string that ends with the string "bdc" including the string "bdc" (without quotes). [0−9a−zA−Z] matches any single printable alphanumeric ASCII character. a??d matches any four character string which begins with a and ends with d.

EXPORTSNone.

KNOWN BUGSSee <https://rt.cpan.org/Dist/Display.html?Status=Active&Queue=libnet>.

SEE ALSONet::Cmd, IO::Socket::SSL.

AUTHORGraham Barr <gbarr@pobox.com <mailto:gbarr@pobox.com>>. Steve Hay <shay@cpan.org <mailto:shay@cpan.org>> is now maintaining libnet as of version 1.22_02.

COPYRIGHTCopyright (C) 1995−1997 Graham Barr. All rights reserved. Copyright (C) 2013−2016, 2020 Steve Hay. All rights reserved.

LICENCEThis module is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e. under the terms of either the GNU General Public License or the Artistic License, as specified in the LICENCE file.

VERSIONVersion 3.15

DATE20 March 2023

HISTORYSee the Changes file.
0
Johanes Gumabo
Data Size   :   56,188 byte
man-Net::NNTP.3pmBuild   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 173,747
Visitor ID   :     :  
Visitor IP   :   3.138.67.56   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|249|Net::NNTP.3pm|24/25|el══─{─══.|.el══─{─══. ds C` )         (htmlprn|149|Net::NNTP.3pm|24/25|.el══─{─══. ds C` |.el══─{─══. ds C` )         (parse_manual_page_|249|Net::NNTP.3pm|27|br══─}─══|'br══─}─══ )         (htmlprn|149|Net::NNTP.3pm|27|'br══─}─══ |'br══─}─══ )         (rof_escape_sequence|91|Net::NNTP.3pm|82|\*(C`Net::NNTP\*(C'\fR is a class implementing a simple NNTP client in Perl as described |\&\f(CW\*(C`Net::NNTP\*(C'\fR is a class implementing a simple NNTP client in Perl as described )         (rof_escape_sequence|91|Net::NNTP.3pm|96|\*(C`Host\*(C'\fR option described below. If no host is passed |given then it may be passed as the \f(CW\*(C`Host\*(C'\fR option described below. If no host is passed )         (rof_escape_sequence|91|Net::NNTP.3pm|97|\*(C`NNTPSERVER\*(C'\fR then |then two environment variables are checked, first \f(CW\*(C`NNTPSERVER\*(C'\fR then )         (rof_escape_sequence|91|Net::NNTP.3pm|98|\*(C`NEWSHOST\*(C'\fR, then \f(CW\*(C`Net::Config\*(C'\fR is checked, and if a host is not found |\&\f(CW\*(C`NEWSHOST\*(C'\fR, then \f(CW\*(C`Net::Config\*(C'\fR is checked, and if a host is not found )         (rof_escape_sequence|91|Net::NNTP.3pm|99|\*(C`news\*(C'\fR is used. |then \f(CW\*(C`news\*(C'\fR is used. )         (rof_escape_sequence|91|Net::NNTP.3pm|105|\*(C`PeerAddr\*(C'\fR option in IO::Socket::INET, or a reference to |the \f(CW\*(C`PeerAddr\*(C'\fR option in IO::Socket::INET, or a reference to )         (rof_escape_sequence|91|Net::NNTP.3pm|113|\*(C`starttls\*(C'\fR. |upgrade with \f(CW\*(C`starttls\*(C'\fR. )         (rof_escape_sequence|91|Net::NNTP.3pm|124|\*(C`Net::NNTP\*(C'\fR will issue a \f(CW\*(C`MODE READER\*(C'\fR command |will be to innd, by default \f(CW\*(C`Net::NNTP\*(C'\fR will issue a \f(CW\*(C`MODE READER\*(C'\fR command )         (rof_escape_sequence|91|Net::NNTP.3pm|125|\*(C`Reader\*(C'\fR option is given |so that the remote server becomes nnrpd. If the \f(CW\*(C`Reader\*(C'\fR option is given )         (rof_escape_sequence|91|Net::NNTP.3pm|142|\*(C`Net::NNTP\*(C'\fR inherits from \f(CW\*(C`Net::Cmd\*(C'\fR so methods defined in \f(CW\*(C`Net::Cmd\*(C'\fR may |\&\f(CW\*(C`Net::NNTP\*(C'\fR inherits from \f(CW\*(C`Net::Cmd\*(C'\fR so methods defined in \f(CW\*(C`Net::Cmd\*(C'\fR may )         (rof_escape_sequence|91|Net::NNTP.3pm|154|\*(C`new\*(C'\fR already. |Any arguments necessary for SSL must be given in \f(CW\*(C`new\*(C'\fR already. )         (rof_escape_sequence|91|Net::NNTP.3pm|173|\*(C`newnews\*(C'\fR |client will obtain the \f(CW$msgid\fR from a list provided by the \f(CW\*(C`newnews\*(C'\fR )         (rof_escape_sequence|91|Net::NNTP.3pm|177|\*(C`undef\*(C'\fR will be returned. |If there is an error then \f(CW\*(C`undef\*(C'\fR will be returned. )         (rof_escape_sequence|91|Net::NNTP.3pm|181|\*(C`article\*(C'\fR but only fetches the body of the article. |Like \f(CW\*(C`article\*(C'\fR but only fetches the body of the article. )         (rof_escape_sequence|91|Net::NNTP.3pm|185|\*(C`article\*(C'\fR but only fetches the headers for the article. |Like \f(CW\*(C`article\*(C'\fR but only fetches the headers for the article. )         (rof_escape_sequence|91|Net::NNTP.3pm|203|\*(C`nntpstat\*(C'\fR command is similar to the \f(CW\*(C`article\*(C'\fR command except that no |The \f(CW\*(C`nntpstat\*(C'\fR command is similar to the \f(CW\*(C`article\*(C'\fR command except that no )         (rof_escape_sequence|91|Net::NNTP.3pm|205|\*(C`nntpstat\*(C'\fR command serves to set the "current article pointer" without |the \f(CW\*(C`nntpstat\*(C'\fR command serves to set the "current article pointer" without )         (rof_escape_sequence|91|Net::NNTP.3pm|208|\*(C`nntpstat\*(C'\fR command to |Using the \f(CW\*(C`nntpstat\*(C'\fR command to )         (rof_escape_sequence|91|Net::NNTP.3pm|232|\*(C`ihave\*(C'\fR command informs the server that the client has an article |The \f(CW\*(C`ihave\*(C'\fR command informs the server that the client has an article )         (rof_escape_sequence|91|Net::NNTP.3pm|240|\*(C`datasend\*(C'\fR and \f(CW\*(C`dataend\*(C'\fR methods from Net::Cmd |\&\f(CW\*(C`datasend\*(C'\fR and \f(CW\*(C`dataend\*(C'\fR methods from Net::Cmd )         (rof_escape_sequence|91|Net::NNTP.3pm|260|\*(C`postok\*(C'\fR will return \fItrue\fR if the servers initial response indicated |\&\f(CW\*(C`postok\*(C'\fR will return \fItrue\fR if the servers initial response indicated )         (rof_escape_sequence|91|Net::NNTP.3pm|288|\*(C`list\*(C'\fR, but the |The result is the same as \f(CW\*(C`list\*(C'\fR, but the )         (rof_escape_sequence|91|Net::NNTP.3pm|315|\*(C`datasend\*(C'\fR and \f(CW\*(C`dataend\*(C'\fR methods from Net::Cmd |\&\f(CW\*(C`datasend\*(C'\fR and \f(CW\*(C`dataend\*(C'\fR methods from Net::Cmd )         (rof_escape_sequence|91|Net::NNTP.3pm|321|\*(C`datasend\*(C'\fR or as the \f(CW$message\fR |The message, either sent via \f(CW\*(C`datasend\*(C'\fR or as the \f(CW$message\fR )         (rof_escape_sequence|91|Net::NNTP.3pm|381|\*(C`xover\*(C'\fR. |by \f(CW\*(C`xover\*(C'\fR. )         (rof_escape_sequence|91|Net::NNTP.3pm|391|\*(C`list\*(C'\fR but only active groups that match the pattern are returned. |Similar to \f(CW\*(C`list\*(C'\fR but only active groups that match the pattern are returned. )         (rof_escape_sequence|91|Net::NNTP.3pm|414|\*(C`overview_fmt\*(C'\fR. |The names of the fields can be obtained by calling \f(CW\*(C`overview_fmt\*(C'\fR. )         (rof_escape_sequence|91|Net::NNTP.3pm|423|\*(C`xhdr\*(C'\fR except the is will be restricted to |The result is the same as \f(CW\*(C`xhdr\*(C'\fR except the is will be restricted to )         (rof_escape_sequence|91|Net::NNTP.3pm|480|\*(C`NNTP\*(C'\fR protocol uses the \f(CW\*(C`WILDMAT\*(C'\fR format for patterns. |The \f(CW\*(C`NNTP\*(C'\fR protocol uses the \f(CW\*(C`WILDMAT\*(C'\fR format for patterns. )         (rof_escape_sequence|91|Net::NNTP.3pm|494|\*(C`*\*(C'\fR to match any sequence of zero or more |The first is an asterisk \f(CW\*(C`*\*(C'\fR to match any sequence of zero or more )         (rof_escape_sequence|91|Net::NNTP.3pm|497|\*(C`?\*(C'\fR to match any single character. The |The second is a question mark \f(CW\*(C`?\*(C'\fR to match any single character. The )         (rof_escape_sequence|91|Net::NNTP.3pm|505|\*(C`]\*(C'\fR may be used in a set if it is the first |close square bracket \f(CW\*(C`]\*(C'\fR may be used in a set if it is the first )         (rof_escape_sequence|91|Net::NNTP.3pm|510|\*(C`^\*(C'\fR at |way as the third with the addition of a caret character \f(CW\*(C`^\*(C'\fR at )         (rof_escape_sequence|91|Net::NNTP.3pm|515|\*(C`[\*(C'\fR, |invalidate the special meaning of an open square bracket \f(CW\*(C`[\*(C'\fR, )