in reply to Using POP3
In general, $! will not be set by routines that don't involve interaction with the local OS--hence the alternate name for it (if you use English;), $OS_ERROR. Many people do set $@ ($EVAL_ERROR) in subroutines where printing a warning to STDERR is not appropriate.
However, in this case, you needed to read the documentation a little more closely:
login ( [ USER [, PASS ]] )
Send both the the USER and PASS commands. If PASS is not given the Net::POP3 uses Net::Netrc to lookup the password using the host and username. If the username is not specified then the current user name will be used. Returns the number of messages in the mailbox. However if there are no messages on the server the string "0E0" will be returned. This is will give a true value in a boolean context, but zero in a numeric context.
If there was an error authenticating the user then undef will be returned.
Testing to see if your call returned undef or 0E0 is left as an exercise to the reader. :-)
|
|---|