in reply to Login Error

Hi, You don't need to use eval in this case. First of all you may want check whether new() returns something you can use and then you safely can call login. This small script will hopefully show you one possible direction:
use Net::POP3; my $pop = Net::POP3->new("pluto.runbox.com"); if ($pop) { my $msg = $pop->login("test21","test"); if ($msg) { $msg eq '0E0' and $msg = 0; print $msg." messages\n"; } else { print "Couldn't read...\n" } $pop->quit(); } else { print "Couldn't connect...\n" }
-- slurp

Replies are listed 'Best First'.
RE: Re: Login Error
by Fastolfe (Vicar) on Aug 01, 2000 at 22:40 UTC
    Just FYI, "0E0" ("0 but true") evaluates to true in a boolean context but will still equal zero if you do a numeric test. So you don't have to do a string comparison against '0E0'. A simple if ($msg) { ... if ($msg == 0) { ... } } would work as you'd expect (for cases where you're testing), and forcing it to be numeric could easily be done just by adding zero ($msg += 0;) or printing it out via s?printf.