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

I am sorry I tried this and get only

Starting script
conecting to POP3 server....
Conected.
Receiving mails...
the message HASH(0x1b4440c) is bytes long.
there is 1 messages
Done.

This was only one what I get from your code... Login is correct I checking it on my local instlation of mail server:

Wed 2001-03-07 12:22:29: 60:8 Accepting POP connection from 10.0.0.75
Wed 2001-03-07 12:22:29: 60:8 +OK xxx.cz POP MDaemon ready using UNREGISTERED SOFTWARE 3.5.4
Wed 2001-03-07 12:22:29: 60:8 USER xxxxxx
Wed 2001-03-07 12:22:29: 60:8 +OK xxxxx... Recipient ok
Wed 2001-03-07 12:22:29: 60:8 PASS ******
Wed 2001-03-07 12:22:29: 60:8 +OK xxxxx@xxxxx.cz's mailbox has 2 total messages (20354 octets).
Wed 2001-03-07 12:22:29: 60:8 STAT
Wed 2001-03-07 12:22:29: 60:8 +OK 2 20354
Wed 2001-03-07 12:22:29: 60:8 LAST
Wed 2001-03-07 12:22:29: 60:8 +OK 0
Wed 2001-03-07 12:22:29: 60:8 LIST
Wed 2001-03-07 12:22:29: 60:8 +OK 2 20354
Wed 2001-03-07 12:22:29: 60:8 1 18831
Wed 2001-03-07 12:22:29: 60:8 2 1523
Wed 2001-03-07 12:22:29: 60:8 .
Wed 2001-03-07 12:22:29: 60:8 QUIT
Wed 2001-03-07 12:22:29: 60:8 +OK xxxxx@xxxxx.cz xxxxx.cz POP Server signing off (2 messages left)
Wed 2001-03-07 12:22:29: 60:8 POP session complete, 0 bytes transferred!

But as you can see scripts list mail corectly but code cannot take results. Debbuger message:

Reference found where even-sized list expected at c:\windows\TEMP\DzTemp.pl line 53.
Use of uninitialized value in concatenation (.) at c:\windows\TEMP\DzTemp.pl line 55.

Replies are listed 'Best First'.
(bbfu) (list not working) Re(3): net::pop3 usage
by bbfu (Curate) on Mar 08, 2001 at 06:28 UTC

    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.

      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")