diff options
author | Graham Barr <gbarr@pobox.com> | 1999-05-05 06:20:00 +0000 |
---|---|---|
committer | Graham Barr <gbarr@pobox.com> | 1999-05-05 06:20:00 +0000 |
commit | d8d7e75c6adcac4cd80239eafd41f10e642a43d8 (patch) | |
tree | 0629022cb27b8675e234ed328bb0d585ac91feac | |
parent | 90273b47f595379caa47b73eda2964ed1c81909c (diff) | |
download | perl-libnet-d8d7e75c6adcac4cd80239eafd41f10e642a43d8.tar.gz |
Net::POP3
- login now returns "0E0" when there are no messages on te server. This is true in a boolean context, but zero in a numeric context
-rw-r--r-- | Net/POP3.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Net/POP3.pm b/Net/POP3.pm index ea04d2a..670d271 100644 --- a/Net/POP3.pm +++ b/Net/POP3.pm @@ -13,7 +13,7 @@ use Net::Cmd; use Carp; use Net::Config; -$VERSION = "2.18"; # $Id: //depot/libnet/Net/POP3.pm#12 $ +$VERSION = "2.19"; # $Id: //depot/libnet/Net/POP3.pm#13 $ @ISA = qw(Net::Cmd IO::Socket::INET); @@ -144,8 +144,10 @@ sub pass return undef unless($me->_PASS($pass)); - ${*$me}{'net_pop3_count'} = ($me->message =~ /(\d+)\s+message/io) + my $ret = ${*$me}{'net_pop3_count'} = ($me->message =~ /(\d+)\s+message/io) ? $1 : ($me->popstat)[0]; + + $ret ? $ret : "0E0"; } sub reset @@ -407,9 +409,11 @@ C<Net::POP3> uses C<Net::Netrc> to lookup the password using the host and username. If the username is not specified then the current user name will be used. -Returns the number of messages in the mailbox. +Returns the number of messages in the mailbox. However if there are no +messages on the server the string C<"0E0"> will be returned. This is +will give a true value in a boolean context, but zero in a numeric context. -If the server cannot authenticate C<USER> the I<undef> will be returned. +If there was an error authenticating the user then I<undef> will be returned. =item apop ( USER, PASS ) |