Hello,
I'm working on a new MUA, and I'm using Mail::Box as the backend right
now (if interested: http://developer.berlios.de/projects/oserp/).
So far, Mail::Box has had all the features I needed, and continues to
make adding features very easy. The API is very nice. There's one thing
I haven't been able to figure out yet... how to expunge deleted messages.
I've got a message listing, I flag a bunch of messages as deleted:
$folder->message($curmsg)->deleted(1);
If I close that folder (quiting, or changing folders), those messages
get deleted (or left in there, if save_deleted => 1, depending on that
users config settings).
The problem is, I'd like to offer a button to clean up the deleted
messages before I close the folder. I tried the following code, and
depending on the backend I use, I get different problems/errors.
Here's the snippet of code I have that is trying to expunge the messages
(I've removed a bunch of code that doesn't really matter):
my $deleted_count = $folder->messages('DELETED');
if ($deleted_count) {
my $write_success = $folder->write();
if ($write_success) {
$folder = $write_success;
$folder->update();
$last_msg = (scalar $folder->messages) - 1;
}
}
When using Mail::Box::Parse::C as the backend, I get some errors, then
it dies:
Use of uninitialized value in subroutine entry at /usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd/Mail/Box/Parser/C.pm line 105.
Use of uninitialized value in subroutine entry at /usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd/Mail/Box/Parser/C.pm line 114.
Use of uninitialized value in subroutine entry at /usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd/Mail/Box/Parser/C.pm line 105.
Use of uninitialized value in subroutine entry at /usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd/Mail/Box/Parser/C.pm line 114.
Use of uninitialized value in subroutine entry at /usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd/Mail/Box/Parser/C.pm line 105.
Use of uninitialized value in subroutine entry at /usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd/Mail/Box/Parser/C.pm line 132.
ERROR: Unable to read delayed body.
Can't call method "string" on an undefined value at /usr/local/lib/perl5/site_perl/5.6.1/Mail/Message/Body/Delayed.pm line 85.
When using Mail::Box::Parser::Perl as the backend, I get a bunch of errors.
The memory usage stays normal for while, and when I jump around to the
begining or end of the folder, the memory usage jumps WAY up (12mb to 88mb
on a less than 1mb mbox). I've had the memory usage jump way up without
getting any errors, so the errors and the memory usage appears to be
unrelated. Anyway, it causes something to go very wrong.
ERROR: File too short to get write message 144 (3451, 6852)
ERROR: File too short to get write message 1 (, 1259160)
ERROR: File too short to get write message 2 (, 1255083)
ERROR: File too short to get write message 3 (, 1254180)
ERROR: File too short to get write message 4 (, 1251259)
ERROR: File too short to get write message 5 (, 1247111)
ERROR: File too short to get write message 6 (, 1241723)
ERROR: File too short to get write message 7 (, 1240787)
ERROR: File too short to get write message 8 (, 1239885)
....similar messages...
ERROR: File too short to get write message 142 (, 45285)
ERROR: File too short to get write message 143 (, 1006)
ERROR: File too short to get write message 144 (, 6852)
While talking about memory usage, if a folder is opened, memory usage goes
up (of course). But if I close it, and re-open it, memory usage goes up
again. This continues on every iteration, as though not all objects are
being destroyed. Is this is known issue?
I was going to work around the write() problems by closing and reopening
the folder, but that seems to have its own problems.
Any thoughts on what I should do?
--
Josh I.
PS - I can throw together an example script if needed
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.