Net::NNTP::Client - a module to simulate an entire NNTP client
use Net::NNTP::Client; my $client = new Net::NNTP::Client('news.cso.uiuc.edu', 'server' => 'news.cso.uiuc.edu', 'port' => 119, 'user' => 'guest', 'pass' => 'guest' );
See below for the list of functions.
Net::NNTP is a module designed to provide a common interface to NNTP servers. This module is an extension of this; it contains a Net::NNTP reference, in addition to various cached information about the server and enough information to reconnect again in the case of a hang-up.
Creates a new object and returns it.
NAME is mandatory, and is the name of the connection, as well as (by default) the server name.
OPTIONS is a list of key/value pairs; the useful keys are:
name, server, port, user, pass, debug, timeout
Each of these can be modified with its corresponding function.
Returns the name of the object. If
NAME is passed, then it sets the name to its value.
Returns the NNTP server name that the object will connect to. If
SERVER is passed, then it sets the server name to its value.
Returns the TCP port number that the object will communicate with. If
PORT is passed, then the port number is set to its value.
Returns the user name that the object will authenticate itself to the NNTP server with. If
USER is passed, then the user name is set to its value.
Returns the password that the object will authenticate itself to the NNTP server with. If
PASS is passed, then the password is set to its value.
Returns true if we should print debugging information from the NNTP connection. Can be set with
Returns the timeout value of the NNTP connection. Defaults to 120. Can be set with
These three functions create the socket connection to an NNTP server. The connection is made to the server found by
server() and the port at
port(). If the connection is already open, then it returns that connection; otherwise, it reconnects and continues. Either way, if
pass() are set, then it authenticates as well.
Disconnect from the NNTP server.
If the object is currently connected to the NNTP server, returns 1; otherwise, returns 0.
ITEM from the NNTP server, which is one of
ARGS is the list of arguments to be passed into the appropriate NNTP call (see the Net::NNTP manual pages for
overview_fmt() for details). These items are cached; if no arguments are passed in
ARGS, then this value will be returned instead of fetching new information from the server.
The following methods from Net::NNTP are directly implemented by this object. The real difference is that they will all try to reconnect to the server before running themselves; if this fail, then they return undef. Refer to Net::NNTP for details on how to use them.
article, head, body, nntpstat, group, ihave, last, date, postok, authinfo, newgroups, newnews, next, post, slave, quit, distributions, subscriptions, xgtitle, xhdr, xover, xpath, xpat, xrover, listgroup
Also, these functions have been re-implemented with
active, active_times, newsgroups, overview_fmt, list
quit() has been re-implemented with
If you hadn't noticed, the real point of this is that this can be used in the place of Net::NNTP in a lot of situations. It doesn't offer too many advantages above it, though. Oh well.
The caching done by
load() isn't all that hot. I'm not sure of its robustness for reconnections yet.
Written by Tim Skirvin <firstname.lastname@example.org>.
Copyright 2000 by Tim Skirvin <email@example.com>. This code may be redistributed under the same terms as Perl itself.