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

Re: Not Quite perl...

by crouchingpenguin (Priest)
on May 09, 2003 at 16:56 UTC ( [id://256933]=note: print w/replies, xml ) Need Help??


in reply to Not Quite perl...

As Limbic~Region pointed out, Mail::Box is perfect for this sort of thing. Here is an example (assuming mbox format):

#!/usr/bin/perl use strict; use warnings; use diagnostics; use Mail::Box::Manager; my ($folder1,$folder2,$folder3) = @ARGV; my $mgr = Mail::Box::Manager->new( folderdir => [ '.' ] ); my $f1 = $mgr->open(folder => $folder1, ) or die $!; my $f2 = $mgr->open(folder => $folder2, ) or die $1; my $f3 = $mgr->open(folder => $folder3, create => 1, access => 'rw', ) + or die $!; foreach my $msg ( $f1->messages(),$f2->messages() ){ $msg->copyTo($f3) if $msg; } # or $mgr->copyMessage($f3, ($f1->messages(),$f2->messages()) ); $mgr->closeAllFolders(); 1;

cp
----
"Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-18 07:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found