NAME
Net::NNTP::Proxy - a news server in perl
SYNOPSIS
use Net::NNTP::Proxy;
my $server = new Net::NNTP::Proxy || die "Couldn't start the server: $!\n";
$server->push(new Net::NNTP::Client);
$server->listen(9119);
my $client = $server->connect;
See below for more functions.
DESCRIPTION
This package is a basic news server written in perl. It contains a list of Net::NNTP::Client connections, and talks to all of these to get its data; it then serves it back out to a port just like a regular news server. It's also clean enough to run multiple-processes (and maybe even multi-threaded, if I'm lucky.)
newsproxy.pl is used to actually run this thing.
METHODS
NETWORK AND FUNCTIONALITY
These functions create the object and connect it to the network.
- new ( )
-
Create a new server object. Doesn't actually bind to the port; you still need to use
listen()
for that. - openport ( [PORT] )
-
Listens on
PORT
for a TCP connection. - closeport ()
-
Stops listening for a TCP connection.
- connect ( FILEHANDLE )
-
Connects to the given
FILEHANDLE
. Returns the filehandle again. - disconnect ( FILEHANDLE )
-
Disconnects from
FILEHANDLE
, closing it in the process. - process ( FILEHANDLE, LINE )
-
Process
LINE
, which was received fromFILEHANDLE
, and call the appropriate news function (which are all documented below). Returns
NEWS SERVERS
These functions return and manipulate the list of news servers that the object connects to and works with.
- newsservers ( )
-
Returns a reference to an array containing the list of news servers that can be accessed.
- push ( SERVER [, SERVER [, SERVER [...]]] )
-
Adds
SERVER
item onto the end of the list of news servers. - pop ( )
-
Removes the first item from the list of the news servers.
NEWS FUNCTIONS
These functions implement news functionality. Return values are designed to be written to a socket, which is taken care of by process()
. None of this stuff is overly well documented; it follows the NNTP standards well where possible, however.
- authinfo ( USER, PASS )
-
Not yet implemented.
- article ( ID [, HEAD, BODY] )
-
Retrieve and return the article indicated by
ID
. Looks through the list of news servers in order; the first server to have the article returns it. - body ( ID )
-
As
article()
, but just returns the body. - date ()
-
Returns the current date from the server.
- group ( GROUP )
-
Changes to the given
GROUP
. - head ( ID )
-
As
article()
, but just returns the headers. - help ()
-
Not yet implemented.
- ihave ()
-
Not yet implemented
- last ()
-
Stats the previous message, if there is one. See
stat()
. - list ( TYPE ARGS )
-
Lists off a certain value. Valid values are:
active ( PATTERN ) active.times newsgroups ( PATTERN ) overview.fmt (NOT YET IMPLEMENTED)
- listgroup ( GROUP )
-
Loads up a given group, and gets a list of articles in it.
- mode ( STRING )
-
Sets the reader mode. At present, only 'reader' works.
- newgroups ( GROUPS, DATE, TIME, [TZ] )
-
Not yet implemented
- newnews ( GROUPS, DATE, TIME, [TZ] )
-
Not yet implemented
- slave ()
-
Not yet implemented
- xgtitle ( GROUP_PATTERN )
-
Not yet implemented
- xhdr ( RANGE | ID )
-
Not yet implemented
- xover ( RANGE )
-
Returns the overview information from the given
RANGE
. - xpat ( HEADER, RANGE | ID, PATTERN [, PATTERN [, PATTERN ]] )
-
Not yet implemented
- xpath ( ID )
-
Not yet implemented
- quit ( FILEHANDLE )
-
Close
FILEHANDLE
and quit.
REQUIREMENTS
News::Article
, Net::NNTP
NOTES
This documentation is basically functional, but not much more.
SEE ALSO
Net::NNTP, Net::NNTP::Client, newsproxy.pl
TODO
Write better documentation. Write other news server types that aren't Net::NNTP::Client. Implement the rest of the functions that I haven't gotten around to yet. Speed it up.
AUTHOR
Written by Tim Skirvin <tskirvin@killfile.org>.
COPYRIGHT
Copyright 2000-2002 by Tim Skirvin <tskirvin@killfile.org>. This code may be redistributed under the same terms as Perl itself.
6 POD Errors
The following errors were encountered while parsing the POD:
- Around line 61:
You forgot a '=back' before '=head2'
- Around line 65:
'=item' outside of any '=over'
- Around line 230:
You forgot a '=back' before '=head2'
- Around line 235:
'=item' outside of any '=over'
- Around line 255:
You forgot a '=back' before '=head2'
- Around line 262:
'=item' outside of any '=over'