I'm writing an email script so I can check my mail through perl. Once in a while I recieve an error that returns the login method of Net::POP3 as undefined. This exits the script. I've been trying to catch the error using an eval, but when I use it, I can't login. The code is below. Thanx for your help, I hate to be such a bother to the PerlMonks (with my frequent posts and all).
sub login() {
print "logging in...\n";
$pop3 = Net::POP3->new($host);
LOGIN: if ($numb = eval'$pop3->login("$username", "$password"'){
system("cls");
print "logged in...\n";
$status = 1;
$numb =~ s/^0E0$/0/;
print "you have $numb messages...\n";
$variable = $numb;
} else {
print $numb;
print "couldn't login, try again?[y/n] ";
$answer = <STDIN>;
if ($answer =~ /y/i) {
login();
}
}
goto PROMPT;
}
- p u n k k i d
"Reality is merely an illusion, albeit a very persistent one." -Albert Einstein
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.