Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Re: mail box cleanup

by markov (Scribe)
on Jan 22, 2004 at 23:52 UTC ( #323368=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: mail box cleanup
in thread mail box cleanup

Your question is a little confusing. Is it a mbox folder on a local machine or a folder on a remote machine?

In case of the former, you may not want to process each message line by line, to be fast. The messages are separated by lines starting with 'From '. But how do you know which messages to delete? Using MailBox, you could write

script: while(my $msg = Mail::Message->read(\*STDIN)) { $msg->write if $want_to_keep_it; } ./script <large >smaller

That's not the best way to process folders, but most memory preserving.

In case of a remote folder, you can open it using MailBox. It is a lazy implementation: only the messages you touch will be dowloaded. If you only touch the header, then only the header is downloaded. Even for large folders, memory consumption may stay in limits.

Sometimes, you should process a file in batches: download and process a few, than reopen the folder and process another few. In any case, if you have huge sets of data, your code become more complicated.

Concluding: as author of MailBox, I didn't receive any complaints about installation or test problems from you. That means that the (maybe) misfunction of the module is your problem! Make it my problem!


Comment on Re: Re: Re: mail box cleanup
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://323368]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2014-09-19 17:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (143 votes), past polls