Wise Monks,
At work, i have to use the Net::POP3 module to fetch mail from a pop3 box. However, i get a bunch of errors that i don't get.
use strict;
use warnings;
use Net::POP3;
...
if (my $pop3 = Net::POP3->new ($serverName, 'Timeout' => 30))
{
if (my $numberOfMessages = $pop3->login ($user, $pass))
{
if ($numberOfMessages == 0)
{
WriteLog ('info', "No new messages");
}
else
{
WriteLog ('info', "Found " . ($numberOfMessages + 0) . " new obj
+ect(s)");
for (my $messageNumber = 1; $messageNumber <= $numberOfMessages;
+ $messageNumber++)
{
WriteLog ('debug', "\$messageNumber: $messageNumber");
my $messageSize = $pop3->list($messageNumber) || print "Error:
+ $!";
}
}
}
}
the code above prints this:
Use of uninitialized value at /blah/Perl5.6.0Modules/Net/POP3.pm line 298, <GEN1> chunk 1.
Use of uninitialized value at /blah/Perl5.6.0Modules/Net/POP3.pm line 299, <GEN1> chunk 1.
Use of uninitialized value at /blah/Perl5.6.0Modules/Net/POP3.pm line 297, <GEN1> chunk 1.
Use of uninitialized value at /blah/Perl5.6.0Modules/Net/POP3.pm line 302, <GEN1> chunk 1.
Error: Bad file number
And in my log i find that 1 message has been found ($numberOfMessages == 1).
The question is: does anybody know how to solve the 'Bad file number' error?
In reply to Net::POP3
by Jaap
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.