Net::NNTP::Auth - a standard NNTP authentication method


newslib documentation  | view source Contained in the newslib distribution.

Index


NAME

Top

Net::NNTP::Auth - a standard NNTP authentication method

SYNOPSIS

Top

  use Net::NNTP::Auth;
  my ($nntpuser, $nntppass) = Net::NNTP::Auth->nntpauth($server->server);

  use Net::NNTP;
  my $nntp = new Net::NNTP;
  $nntp->authinfo($nntpuser, $nntppass);

DESCRIPTION

Top

NNTP authentication is a standard feature of most news servers nowadays, though many news readers have yet to catch up. When writing your own news reader, though, you have to keep track of this data separately, unless you have a standardized place to store the information - like this module.

This module offers a few functions which parse the local ~/.nntpauth file and return the appropriate data. This file contains lines that look like this:

  news.server.invalid username password 
  news2.server2.invalid username2 password4

That's it. The functions are called by offering forth a SERVER, and the first user/password pair in the file is returned. These values can then be passed into Net::NNTP's nntpauth() function.

METHODS

Top

nntpauth ( SERVER )

Parses ~/.nntpauth for the given SERVER. Returns two items - the user name and the password. If one or both of these is not found, then the appropriate value is set to 'undef'.

nntpuser ( SERVER )
nntppass ( SERVER )

Invokes nntpauth(), and returns the appropriate item from the list - the user name for nntpuser(), or the password for nntppass().

NOTES

Top

Please note that this is an extremely small module. The only real purpose is to standardize on the ~/.nntpauth format that I've been using for a long time. It's convenient. Why not?

AUTHOR

Top

Written by Tim Skirvin <tskirvin@killfile.org>

LICENSE

Top

This code may be redistributed under the same terms as Perl itself.

COPYRIGHT

Top


newslib documentation  | view source Contained in the newslib distribution.