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
OPTIONS
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.
SERVER
Returns the TCP port number that the object will communicate with. If PORT is passed, then the port number is set to its value.
PORT
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.
USER
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.
PASS
Returns true if we should print debugging information from the NNTP connection. Can be set with DEBUG.
DEBUG
Returns the timeout value of the NNTP connection. Defaults to 120. Can be set with TIMEOUT.
TIMEOUT
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 user() and pass() are set, then it authenticates as well.
server()
port()
user()
pass()
Disconnect from the NNTP server.
If the object is currently connected to the NNTP server, returns 1; otherwise, returns 0.
Loads ITEM from the NNTP server, which is one of active, active.times, newsgroups, or overview.fmt. ARGS is the list of arguments to be passed into the appropriate NNTP call (see the Net::NNTP manual pages for active(), active_times(), newsgroups(), and 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.
ITEM
active
active.times
newsgroups
overview.fmt
ARGS
active()
active_times()
newsgroups()
overview_fmt()
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 load().
load()
active, active_times, newsgroups, overview_fmt, list
And quit() has been re-implemented with disconnect().
quit()
disconnect()
Requires Net::NNTP.
Net::NNTP
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.
Net::NNTP::Proxy, newsproxy.pl, Net::NNTP, News::NNTPAuth
The caching done by load() isn't all that hot. I'm not sure of its robustness for reconnections yet.
Written by Tim Skirvin <tskirvin@killfile.org>.
Copyright 2000 by Tim Skirvin <tskirvin@killfile.org>. This code may be redistributed under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install News::NNTPAuth, copy and paste the appropriate command in to your terminal.
cpanm
cpanm News::NNTPAuth
CPAN shell
perl -MCPAN -e shell install News::NNTPAuth
For more information on module installation, please visit the detailed CPAN module installation guide.