The stupid question is the question not asked | |
PerlMonks |
Re: How to check number of messages using Net::POP3?by duct_tape (Hermit) |
on Dec 23, 2003 at 22:36 UTC ( [id://316731]=note: print w/replies, xml ) | Need Help?? |
Hello It looks like response returns undef when it can not getline. I am assume the reason is that your POP3 server is disconnecting you once you enter a bad password. Not quite sure how to get around the warning other than patch Net::POP3 to handle that more gracefully. You can always disable warnings / diagnostics if the warning really bothers you. It's not always worthwhile to jump through hoops to avoid warnings. Also, here are a few things I noticed when I looked at your code. According to the documentation for Net::POP3, pass returns the number of messages in the mailbox. Since it returns a scalar you don't need to assign it to an array. You can do something like so:
Also, if there are 0 messages in the mailbox pass will return 0E0 which will evaluate to true. Because of this you can bypass your check for defined as if it returned undef then you would've already caught it with your or do {....
Overall everything looks good! Keep up the good work! RegardsBrad
In Section
Seekers of Perl Wisdom
|
|