use Time::Local;
use Net::Config;
-$VERSION = "2.20"; # $Id: //depot/libnet/Net/NNTP.pm#13 $
+$VERSION = "2.22"; # $Id: //depot/libnet/Net/NNTP.pm#18 $
@ISA = qw(Net::Cmd IO::Socket::INET);
sub new
my $inout = shift;
my $text = shift;
- if(($nntp->code == 350 && $text =~ /^(\S+)/)
+ if((ref($nntp) and $nntp->code == 350 and $text =~ /^(\S+)/)
|| ($text =~ /^(authinfo\s+pass)/io))
{
$text = "$1 ....\n"
: undef;
}
+sub articlefh {
+ @_ >= 1 && @_ <= 2 or croak 'usage: $nntp->articlefh( [ MSGID ] )';
+ my $nntp = shift;
+
+ return unless $nntp->_ARTICLE(@_);
+ return $nntp->tied_fh;
+}
+
sub authinfo
{
@_ == 3 or croak 'usage: $nntp->authinfo( USER, PASS )';
: undef;
}
+sub bodyfh
+{
+ @_ >= 1 && @_ <= 2 or croak 'usage: $nntp->bodyfh( [ MSGID ] )';
+ my $nntp = shift;
+ return unless $nntp->_BODY(@_);
+ return $nntp->tied_fh;
+}
+
sub head
{
@_ >= 1 && @_ <= 3 or croak 'usage: $nntp->head( [ MSGID ], [ FH ] )';
: undef;
}
+sub headfh
+{
+ @_ >= 1 && @_ <= 2 or croak 'usage: $nntp->headfh( [ MSGID ] )';
+ my $nntp = shift;
+ return unless $nntp->_HEAD(@_);
+ return $nntp->tied_fh;
+}
+
sub nntpstat
{
@_ == 1 || @_ == 2 or croak 'usage: $nntp->nntpstat( [ MSGID ] )';
: undef;
}
+sub postfh {
+ my $nntp = shift;
+ return unless $nntp->_POST();
+ return $nntp->tied_fh;
+}
+
sub quit
{
@_ == 1 or croak 'usage: $nntp->quit()';
specified article.
If C<FH> is specified then it is expected to be a valid filehandle
-and the result will be printed to it, on sucess a true value will be
-returned. If C<FH> is not specified then the return value, on sucess,
+and the result will be printed to it, on success a true value will be
+returned. If C<FH> is not specified then the return value, on success,
will be a reference to an array containg the article requested, each
entry in the array will contain one line of the article.
Like C<article> but only fetches the headers for the article.
+=item articlefh ( [ MSGID|MSGNUM ] )
+
+=item bodyfh ( [ MSGID|MSGNUM ] )
+
+=item headfh ( [ MSGID|MSGNUM ] )
+
+These are similar to article(), body() and head(), but rather than
+returning the requested data directly, they return a tied filehandle
+from which to read the article.
+
=item nntpstat ( [ MSGID|MSGNUM ] )
The C<nntpstat> command is similar to the C<article> command except that no
C<MESSAGE> can be either an array of lines or a reference to an array.
+The message, either sent via C<datasend> or as the C<MESSAGE>
+parameter, must be in the format as described by RFC822 and must
+contain From:, Newsgroups: and Subject: headers.
+
+=item postfh ()
+
+Post a new article to the news server using a tied filehandle. If
+posting is allowed, this method will return a tied filehandle that you
+can print() the contents of the article to be posted. You must
+explicitly close() the filehandle when you are finished posting the
+article, and the return value from the close() call will indicate
+whether the message was successfully posted.
+
=item slave ()
Tell the remote server that I am not a user client, but probably another
=for html <hr>
-I<$Id: //depot/libnet/Net/NNTP.pm#13 $>
+I<$Id: //depot/libnet/Net/NNTP.pm#18 $>
=cut