X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FNet%2FNNTP.pm;h=79261f889d507c9bf443e20ae9d5d57001155185;hb=f1317c8d183c687b884dabebf7d01723441851a4;hp=56c97b3cafda626bb2d723a556114d464f4db1fa;hpb=686337f3173d259f9dc05f9d6c19a8c95e2cb00b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Net/NNTP.pm b/lib/Net/NNTP.pm index 56c97b3..79261f8 100644 --- a/lib/Net/NNTP.pm +++ b/lib/Net/NNTP.pm @@ -14,7 +14,7 @@ use Carp; 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 @@ -87,7 +87,7 @@ sub debug_text 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" @@ -116,6 +116,14 @@ sub article : 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 )'; @@ -147,6 +155,14 @@ sub body : 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 ] )'; @@ -160,6 +176,14 @@ sub head : 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 ] )'; @@ -296,6 +320,12 @@ sub post : undef; } +sub postfh { + my $nntp = shift; + return unless $nntp->_POST(); + return $nntp->tied_fh; +} + sub quit { @_ == 1 or croak 'usage: $nntp->quit()'; @@ -718,8 +748,8 @@ Retrieve the header, a blank line, then the body (text) of the specified article. If C 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 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 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. @@ -743,6 +773,16 @@ Like C
but only fetches the body of the article. Like C
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 command is similar to the C
command except that no @@ -842,6 +882,19 @@ C and C methods from L C can be either an array of lines or a reference to an array. +The message, either sent via C or as the C +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 @@ -1016,7 +1069,7 @@ the beginning of the test string just inside the open square bracket. The final operation uses the backslash character to -invalidate the special meaning of the a open square bracket C<[>, +invalidate the special meaning of an open square bracket C<[>, the asterisk, backslash or the question mark. Two backslashes in sequence will result in the evaluation of the backslash as a character with no special meaning. @@ -1064,6 +1117,6 @@ it under the same terms as Perl itself. =for html
-I<$Id: //depot/libnet/Net/NNTP.pm#13 $> +I<$Id: //depot/libnet/Net/NNTP.pm#18 $> =cut