in reply to Re: Re: net::pop3 usage
in thread net::pop3 usage

From the errors your getting, it looks like list() returns a hash-ref, not a list. Change the first line of arhuman's code to: %msgs = %{$pop->list()};

and it should work.

HTH

bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.

Replies are listed 'Best First'.
Re: (bbfu) (list not working) Re(3): net::pop3 usage
by LiTinOveWeedle (Scribe) on Mar 12, 2001 at 16:09 UTC
    Thank you this is working very well :-)))) but I have another question please. Methods from Net:Pop3 returns as results true or false meaning that operation was succes or not. But how to do something like this

    unless ( $mail_count = $pop->login( $username, $password ) ) {
    return 0;
    }

    This return to $mail_count number of mails. If there is 0 mails in pop3 box procedure end. But I want terminate procedure if method login will not be succesful. How should I do this?

    Please, if you know, help me. Litin

      Did you read the Net::Pop3 documentation? It says:

      login ( [ USER , PASS ] )
      ...
      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.

      So that suggests that you shouldn't be having the problem you claim and that you can also use defined if you like.

              - tye (but my friends call me "Tye")