Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://323368]
NodeReaper lights some incense and reads Tool and Die

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2018-03-22 12:29 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (274 votes). Check out past polls.