diff options
author | Graham Barr <gbarr@pobox.com> | 2008-02-09 14:44:48 +0000 |
---|---|---|
committer | Graham Barr <gbarr@pobox.com> | 2009-02-24 10:40:49 -0600 |
commit | 4f63fb1d340c21be01969ebcd4249f77507f8626 (patch) | |
tree | 320b4f10b304079214dd80123f1b3ce597c3795d | |
parent | d7a601cb99aa91da6fe994b19525f8439f1aec0f (diff) | |
download | perl-libnet-4f63fb1d340c21be01969ebcd4249f77507f8626.tar.gz |
Allow group to set to a group named "0"
-rw-r--r-- | Net/NNTP.pm | 12 |
1 files 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); |