From 7adfc03b5de79f88c3bae2486f7974fee8872884 Mon Sep 17 00:00:00 2001 From: Graham Barr Date: Sun, 11 Jul 1999 17:57:57 +0000 Subject: Net::POP3 - Added ping method supplied by William Rolston --- Net/POP3.pm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Net/POP3.pm b/Net/POP3.pm index a2d5c0f..f56fa55 100644 --- a/Net/POP3.pm +++ b/Net/POP3.pm @@ -13,7 +13,7 @@ use Net::Cmd; use Carp; use Net::Config; -$VERSION = "2.19"; # $Id: //depot/libnet/Net/POP3.pm#14 $ +$VERSION = "2.20"; # $Id: //depot/libnet/Net/POP3.pm#15 $ @ISA = qw(Net::Cmd IO::Socket::INET); @@ -267,6 +267,17 @@ sub uidl return $uidl; } +sub ping +{ + @_ == 2 or croak 'usage: $pop3->ping( USER )'; + my $me = shift; + + return () unless $me->_PING(@_) && $me->message =~ /(\d+)\D+(\d+)/; + + ($1 || 0, $2 || 0); +} + + sub _STAT { shift->command('STAT')->response() == CMD_OK } sub _LIST { shift->command('LIST',@_)->response() == CMD_OK } sub _RETR { shift->command('RETR',$_[0])->response() == CMD_OK } @@ -279,6 +290,7 @@ sub _UIDL { shift->command('UIDL',@_)->response() == CMD_OK } sub _USER { shift->command('USER',$_[0])->response() == CMD_OK } sub _PASS { shift->command('PASS',$_[0])->response() == CMD_OK } sub _APOP { shift->command('APOP',@_)->response() == CMD_OK } +sub _PING { shift->command('PING',$_[0])->response() == CMD_OK } sub _RPOP { shift->command('RPOP',$_[0])->response() == CMD_OK } sub _LAST { shift->command('LAST')->response() == CMD_OK } @@ -451,9 +463,14 @@ Returns the highest C of all the messages accessed. =item popstat () -Returns an array of two elements. These are the number of undeleted +Returns a list of two elements. These are the number of undeleted elements and the size of the mbox in octets. +=item ping ( USER ) + +Returns a list of two elements. These are the number of new messages +and the total number of messages for C. + =item uidl ( [ MSGNUM ] ) Returns a unique identifier for C if given. If C is not -- cgit v1.2.3-24-ge0c7