MAN page from Old RedHat 6.X libnet-1.0606-1.i386.rpm
Net::NNTP
Section: User Contributed Perl Documentation (3)
Updated: perl 5.005, patch 03
Index NAME
Net::NNTP - NNTP Client class
SYNOPSIS
use Net::NNTP; $nntp = Net::NNTP->new("some.host.name"); $nntp->quit; DESCRIPTION
Net::NNTP is a class implementing a simple NNTP client in Perl as describedin RFC977.
Net::NNTP inherits its communication methods from
Net::Cmd CONSTRUCTOR
- new ( [ HOST ] [, OPTIONS ])
- This is the constructor for a new Net::NNTP object. HOST is thename of the remote host to which a NNTP connection is required. If notgiven two environment variables are checked, first NNTPSERVER thenNEWSHOST, then Net::Config is checked, and if a host is not foundthen news is used.
OPTIONS are passed in a hash like fashion, using key and value pairs.Possible options are:
Timeout - Maximum time, in seconds, to wait for a response from theNNTP 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 connectionwill be to nnrpd, by default Net::NNTP will issue a MODE READER commandso that the remote server becomes innd. If the Reader option is givenwith a value of zero, then this command will not be sent and theconnection will be left talking to nnrpd.
METHODS
Unless otherwise stated all methods return either a
true or
falsevalue, with
true meaning that the operation was a success. When a methodstates that it returns a value, failure will be returned as
undef or anempty list.
- article ( [ MSGID|MSGNUM ] )
- Retrieve the header, a blank line, then the body (text) of thespecified article.
If no arguments are passed then the current article in the currentnewsgroup is returned.
MSGNUM is a numeric id of an article in thecurrent newsgroup, and will change the current article pointer.MSGID is the message id of an article asshown in that article's header. It is anticipated that the clientwill obtain the MSGID from a list provided by the newnewscommand, from references contained within another article, or fromthe message-id provided in the response to some other commands.
Returns a reference to an array containing the article.
- body ( [ MSGID|MSGNUM ] )
- Retrieve the body (text) of the specified article.
Takes the same arguments as article
Returns a reference to an array containing the body of the article.
- head ( [ MSGID|MSGNUM ] )
- Retrieve the header of the specified article.
Takes the same arguments as article
Returns a reference to an array containing the header of the article.
- nntpstat ( [ MSGID|MSGNUM ] )
- The nntpstat command is similar to the article command except that notext is returned. When selecting by message number within a group,the nntpstat command serves to set the ``current article pointer'' withoutsending text.
Using the nntpstat command toselect by message-id is valid but of questionable value, since aselection 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 informationis 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 numberof articles in the group, the number of the first article, the numberof the last article and the group name.
- ihave ( MSGID [, MESSAGE ])
- The ihave command informs the server that the client has an articlewhose id is MSGID. If the server desires a copy of thatarticle, and MESSAGE has been given the it will be sent.
Returns true if the server desires the article and MESSAGE wassuccessfully sent,if specified.
If MESSAGE is not specified then the message must be sent using thedatasend and dataend methods from the Net::Cmd manpage
MESSAGE can be either an array of lines or a reference to an array.
- last ()
- Set the ``current article pointer'' to the previous article in the currentnewsgroup.
Returns the message-id of the article.
- date ()
- Returns the date on the remote server. This date will be in a UNIX timeformat (seconds since 1970)
- postok ()
- postok will return true if the servers initial response indicatedthat it will allow posting.
- authinfo ( USER, PASS )
- list ()
- Obtain information about all the active newsgroups. The results is a referenceto a hash where the key is a group name and each value is a reference to anarray. The elements in this array are:- the first article number in the group,the last 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 distributionpattern or a reference to a list of distribution patterns.The result is the same as list, but thegroups return will be limited to those created after SINCE and, ifspecified, 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 referenceto a list of group patterns. DISTRIBUTIONS is either a distributionpattern or a reference to a list of distribution patterns.
Returns a reference to a list which contains the message-ids of all news postedafter SINCE, that are in a groups which matched GROUPS and adistribution which matches DISTRIBUTIONS.
- next ()
- Set the ``current article pointer'' to the next article in the currentnewsgroup.
Returns the message-id of the article.
- post ( [ MESSAGE ] )
- Post a new article to the news server. If MESSAGE is specified and postingis allowed then the message will be sent.
If MESSAGE is not specified then the message must be sent using thedatasend and dataend methods from the Net::Cmd manpage
MESSAGE can be either an array of lines or a reference to an array.
- slave ()
- Tell the remote server that I am not a user client, but probably anothernews server.
- quit ()
- Quit the remote server and close the socket connection.
Extension methods
These methods use commands that are not part of the
RFC977 documentation. Someservers may not support all of them.
- newsgroups ( [ PATTERN ] )
- Returns a reference to a hash where the keys are all the group names whichmatch PATTERN, or all of the groups if no pattern is specified, andeach value contains the description text for the group.
- distributions ()
- Returns a reference to a hash where the keys are all the possibledistribution names and the values are the distribution descriptions.
- subscriptions ()
- Returns a reference to a list which contains a list of groups whichare recommended for a new user to subscribe to.
- overview_fmt ()
- Returns a reference to an array which contain the names of the fields returnedby xover.
- active_times ()
- Returns a reference to a hash where the keys are the group names and eachvalue is a reference to an array containing the time the groups was createdand an identifier, possibly an Email address, of the creator.
- active ( [ PATTERN ] )
- Similar to list 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 whichmatch 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 referenceto a hash where the keys are the message numbers and each value containsthe text of the requested header for that message.
- xover ( MESSAGE-SPEC )
- The return value will be a referenceto a hash where the keys are the message numbers and each value containsa reference to an array which contains the overview fields for thatmessage.
The names of the fields can be obtained by calling overview_fmt.
- xpath ( MESSAGE-ID )
- Returns the path name to the file on the server which contains the specifiedmessage.
- xpat ( HEADER, PATTERN, MESSAGE-SPEC)
- The result is the same as xhdr except the is will be restricted toheaders where the text of the header matches PATTERN
- xrover
- 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 thevalues are the References: lines from the articles
- listgroup ( [ GROUP ] )
- Returns a reference to a list of all the active messages in GROUP, orthe 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 toan INN server and you have transfer permission your connection willbe connected to the transfer daemon, not the NNTP daemon. Issuingthis command will cause the transfer daemon to hand over controlto the NNTP daemon.
Some servers do not understand this command, but issuing it and ignoringthe response is harmless.
UNSUPPORTED
The following NNTP command are unsupported by the package, and there areno plans to do so.
AUTHINFO GENERIC XTHREAD XSEARCH XINDEX
DEFINITIONS
- MESSAGE-SPEC
- MESSAGE-SPEC is either a single message-id, a single message number, ora reference to a list of two message numbers.
If MESSAGE-SPEC is a reference to a list of two message numbers and thesecond number in a range is less than or equal to the first then the rangerepresents all messages in the group after the first message number.
NOTE For compatibility reasons only with earlier versions of Net::NNTPa message spec can be passed as a list of two numbers, this is depreciatedand a reference to the list should now be passed
- PATTERN
- The NNTP protocol uses the WILDMAT format for patterns.The WILDMAT format was first developed by Rich Salz based onthe format used in the UNIX ``find'' command to articulatefile names. It was developed to provide a uniform mechanismfor matching patterns in the same manner that the UNIX shellmatches filenames.
Patterns are implicitly anchored at thebeginning and end of each string when testing for a match.
There are five pattern matching operations other than a strictone-to-one match between the pattern and the source to bechecked for a match.
The first is an asterisk * to match any sequence of zero or morecharacters.
The second is a question mark ? to match any single character. Thethird specifies a specific set of characters.
The set is specified as a list of characters, or as a range of characterswhere 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 canalso be included in the set as a character it if is the beginningor end of the set. This set is enclosed in square brackets. Theclose square bracket ] may be used in a set if it is the firstcharacter in the set.
The fourth operation is the same as thelogical not of the third operation and is specified the sameway as the third with the addition of a caret character ^ atthe beginning of the test string just inside the open squarebracket.
The final operation uses the backslash character toinvalidate the special meaning of the a open square bracket [,the asterisk, backslash or the question mark. Two backslashes insequence will result in the evaluation of the backslash as acharacter with no special meaning.
- Examples
- [^]-]
- matches any single character other than a close squarebracket 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 beginswith a and ends with d.
SEE ALSO
the
Net::Cmd manpage
AUTHOR
Graham Barr <gbarrAATTpobox.com>
COPYRIGHT
Copyright (c) 1995-1997 Graham Barr. All rights reserved.This program is free software; you can redistribute it and/or modifyit under the same terms as Perl itself.
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- CONSTRUCTOR
- METHODS
- Extension methods
- UNSUPPORTED
- DEFINITIONS
- SEE ALSO
- AUTHOR
- COPYRIGHT
This document was created byman2html,using the manual pages.