(Tried this topic before, with no responses. I'll try again from a
different angle.)
The application I'm writing involves shoving mail in a database and
selectively pulling it back out. I'm mostly operating on headers. I've
gone through a few different iterations, starting from doing all the
mail parsing by hand, through using Mail::Internet and MIME::Tools, and
now I'm obviously using Mail::Box.
Right now, I'm pulling stuff from the database and manually constructing
Mail::Message objects through a method like this (very simplified):
$db_get_messages = $dbh->prepare(
"select headers from messages where ...");
[...]
my $headers;
$db_get_messages->execute();
$db_get_messages->bind_col(1, \$headers);
while ($db_get_messages->fetch()) {
my @headers = split /\n(?!\s+)/, $headers;
my $h = Mail::Message::Head->new();
foreach my $l (@headers) {
next if ($l =~ /^(?:From\s.*)$/);
$l =~ /^(\S+):\s(.*)/s ;
if (defined($1) && defined($2)) {
$h->add($1 => $2);
}
}
my $message = Mail::Box::Message->new(head => $h,);
push @messages, $message;
}
This is fine, but it did occur to me that life would be nicer if a Box
object that took a SQL statement existed; would be extremely convenient
for a number of things.
I'm working at coming up to speed on the modules, but as my last
message indicated, I have a massive version switch to swallow, and
am new to Mail::Box in general.
So, I'm wondering what the minimal set of methods required would be to
define a Mail::Box::DBI class that allowed read access.
Any hints would be appreciated.
-j
--
Jamie Lawrence jal@xxxxxxx
|