私はActiveStatePerl5.10.0でWindowsXPSP3を使用しており、POP3を介してGmailを読み取ろうとして、CPANのNet::POP3-から取得/編集されたこの関数を作成しました。
my $pop = Net::POP3->new('pop.gmail.com',
Timeout => 60,
Port => 995,
Debug => 1) || die "$!";
my $num = $pop->login('xyz@gmail.com', 'password');
if (!defined($num))
{
die "Error: couldn't sign-in to your email account.\n";
}
elsif ($num > 0)
{
warn "There are $num message(s) in your inbox.\n";
my $msgnums = $pop->list;
foreach my $msgnum (keys %$msgnums)
{
my $msg = $pop->get($msgnum);
print @$msg;
}
}
else
{
die "There are no messages in your inbox. (Nothing to do.)\n"
}
$pop->quit;
コードは、次のエラーメッセージで単にタイムアウトします。
Use of uninitialized value in numeric eq (==) at C:/Perl/lib/Net/POP3.pm line 59.
Bad file descriptor at pop3.pl line xxx (i.e., the Net::POP3->new() line)
タイムアウトが発生する前のNet::POP3からのデバッグ情報は次のとおりです。
Net::POP3>>> Net::POP3(2.29)
Net::POP3>>> Net::Cmd(2.29)
Net::POP3>>> Exporter(5.62)
Net::POP3>>> IO::Socket::INET(1.31)
Net::POP3>>> IO::Socket(1.30_01)
Net::POP3>>> IO::Handle(1.27)
Net::POP3=GLOB(0x20d253c): Timeout at pop3.pl line xxx
私も使ってみMail::POP3Client
ました; IO::SOCKET::SSL
CPANもPPMもWindowsXPとその依存関係(など)をインストールしないため、WindowsXPには喜びはありません。
私のコードの何が問題になっているのか、および/またはActivePerl5.10.0を搭載したWindowsXPでPOP3を介してGmailを読み取る方法について何か考えはありますか?
Gmailによると、標準の設定手順は次のとおりです。
Incoming Mail (POP3) Server - requires SSL: pop.gmail.com
Use SSL: Yes
Port: 995