Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Not Quite perl...

by crouchingpenguin (Priest)
on May 09, 2003 at 16:56 UTC ( #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? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2022-11-30 04:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?