Jaap has asked for the wisdom of the Perl Monks concerning the following question:

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?

Replies are listed 'Best First'.
Re: Net::POP3
by Jaap (Curate) on Oct 25, 2002 at 15:26 UTC
    Ah the problem lies in a piece of code not printed here, with a fork() action.
    Sorry to bother you.