[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-mailbox
Subject:    Re: Problems with your package
From:       Mark Overmeer <Mark () Overmeer ! net>
Date:       2002-06-10 11:38:15
[Download RAW message or body]

* Max Poduhoroff (cyborg@kiev.farlep.net) [020610 12:44]:
> The task is I need parse mailbox that has recursive attaches: message can
> be attached recursive to other message. The depth of attachmets can be
> a huge.
> What I am doing wrong? 

- First of all: please 'use warnings' and 'use strict'

- Secondly: create only one manager for the whole program.

- When you access a message which has multiparts, it is already
  broken into pieces for you: you do not call the parser yourself.
  If that doesn;t work, there must be a bug somewhere else.  So,
  basically your code should be this:

    foreach my $msg ($folder->messages)
    {   process_part($msg->body);
    }

    sub process_part($)
    {   my $body = shift;

        if($body->isMultipart)
        {   process_part($_) foreach $body->parts;
            return;
        }
        
        ...
    }

So: do not call read() when you have an open folder.
Hope it works ;)
-- 
               MarkOv       %-]

------------------------------------------------------------------------
drs Mark A.C.J. Overmeer                                MARKOV Solutions
       Mark@Overmeer.net                          solutions@overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic