From 4f63fb1d340c21be01969ebcd4249f77507f8626 Mon Sep 17 00:00:00 2001 From: Graham Barr Date: Sat, 9 Feb 2008 14:44:48 +0000 Subject: Allow group to set to a group named "0" --- Net/NNTP.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Net/NNTP.pm b/Net/NNTP.pm index a742aed..d7020f3 100644 --- a/Net/NNTP.pm +++ b/Net/NNTP.pm @@ -14,7 +14,7 @@ use Carp; use Time::Local; use Net::Config; -$VERSION = "2.24"; +$VERSION = "2.24_1"; @ISA = qw(Net::Cmd IO::Socket::INET); @@ -213,16 +213,18 @@ sub nntpstat { sub group { @_ == 1 || @_ == 2 or croak 'usage: $nntp->group( [ GROUP ] )'; my $nntp = shift; - my $grp = ${*$nntp}{'net_nntp_group'} || undef; + my $grp = ${*$nntp}{'net_nntp_group'}; return $grp unless (@_ || wantarray); my $newgrp = shift; - return wantarray ? () : undef - unless $nntp->_GROUP($newgrp || $grp || "") - && $nntp->message =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\S+)/; + $newgrp = (defined($grp) and length($grp)) ? $grp : "" + unless defined($newgrp) and length($newgrp); + + return + unless $nntp->_GROUP($newgrp) and $nntp->message =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\S+)/; my ($count, $first, $last, $group) = ($1, $2, $3, $4); -- cgit v1.2.3-24-ge0c7