Hi. I'm having trouble with the Mail::Box::Manager modules in perl. What I'm trying to do is write a script which parses through an mbox mail file and pulls out certain messages based on the date they were written. The script should then add those messages to a new folder. I keep getting error messages which say that there are no methods for moving messages from one mbox to another. My code is below. Anybody have any ideas? Thanks.

Ali
#!/usr/local/bin/perl #usage: ./ml.pl alihakim 2003-05-01 2003-05-31 $filename = shift; #$filename2 = shift; use Date::Calc qw( Date_to_Days Time_to_Date ); use Date::Parse qw( str2time ); use Time::CTime qw( strftime asctime ); use lib "..."; use Mail::Box::Manager; my $start_time = shift; $start_time =~ m/^\d{4}-\d{2}-\d{2}$/ or die; $start_time = str2time( "$start_time 00:00:00" ); my $stop_time = shift; $stop_time =~ m/^\d{4}-\d{2}-\d{2}$/ or die; $stop_time = str2time( "$stop_time 00:00:00" ); #print "20: $start_time\n"; #print "21: $stop_time\n"; $mgr = Mail::Box::Manager->new(); my $ali = Mail::Box::Mbox->new(); $folder = $mgr->open ('mbox',$filename); my $new_folder;# = $ali->open('test','file','./',"create","1","access" +,"rw"); foreach $message ($folder->messages()) { $curr_msg++; my $time = $message->guessTimestamp(); my $atime = asctime (localtime($time)); if (($time >= $start_time) && ($time <= $stop_time)) { $ali->addMessage($message); } } $folder->close();

In reply to using Mail::Box::Manager; by ahakim

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.