NAME
    Mail::Message::DB - DB interface

SYNOPSIS
      ... lock by something ...

        my $_db_args = {
            db_module       => $db_type, # AnyDBM_File
            db_base_dir     => $db_dir,  # /var/spool/ml/@udb@/elena
            db_name         => $db_name, # elena

            # old db_dir in non UDB age: ~fml/public_html/.../elena/
            old_db_base_dir => $args->{ output_dir },
        };

        # Firstly, prepare db object.
        use Mail::Message::DB;
        my $db = new Mail::Message::DB $_db_args;
        $db->set_key($id) if $id;

      ... unlock by something ...

    This module itself provides no lock function. Please lock before use of
    this module.

DESCRIPTION
METHODS
  new($args)
        my $args = {
            db_module    => 'AnyDBM_File',
            db_base_dir  => '/var/spool/ml/@udb@/thread',
            db_name      => 'elena',  # mailing list identifier
            key          => 100,      # article sequence number
        };

    In fml 8 case, Mail::Message::DB object is initialized for each ML (so,
    each domain). "db_name" (mailing list identifier) does not nees the full
    mail address such as "elena@fml.org" since fml8 uses different
    $db_base_dir for each domain.

    For example, this module creates/updates the following databases (e.g.
    /$db_base_dir/$db_name/$table.db where $table is 'article',
    'message_id', 'sender', et.al.).

       /var/spool/ml/@udb@/thread/elena/articles.db
       /var/spool/ml/@udb@/thread/elena/date.db
       /var/spool/ml/@udb@/thread/elena/message_id.db
       /var/spool/ml/@udb@/thread/elena/sender.db
       /var/spool/ml/@udb@/thread/elena/status.db
       /var/spool/ml/@udb@/thread/elena/thread_id.db

    Almost all tables use $key (article sequence number) as the primary key
    since it is unique in a mailing list articles.

        # key => filepath
        $article = {
            100 => /var/spool/ml/elena/spool/100,
            101 => /var/spool/ml/elena/spool/101,
        };

PARSE and ANALYZE
  add($msg)
    analyze the given message $msg to insert information on message header,
    thread relation into databases.

SUMMARY
    retrieve summary on thread et.al.

  get_thread_summary($id).
    return the following thread summary around the primary key $id.

        my $summary = {
            prev_id        => $prev_id,
            next_id        => $next_id,
            prev_thread_id => $prev_thread_id,
            next_thread_id => $next_thread_id,
        };

    For example, supporse $id 5 and the thread link is (3 5 6):

        my $summary = {
            prev_id        => 4,
            next_id        => 6,
            prev_thread_id => 3,
            next_thread_id => 6,
        };

  get_thread_data($thread_args)
    return thread data around the specified key. The data is a hash of array
    recursively explorered in the thread link relation.

        hash = {
            id => [ id1 id2 id2a id2b id3 ... ],
        };

UTILITY FUNCTIONS
    All methods are module internal.

DATABASE PARAMETERS MANIPULATION
HANDLE TABLE
HANDLE OLD DB by DEMAND COPYING
DEBUG
TODO
CODING STYLE
    See "http://www.fml.org/software/FNF/" on fml coding style guide.

AUTHOR
    Ken'ichi Fukamachi

COPYRIGHT
    Copyright (C) 2003,2004,2005,2006 Ken'ichi Fukamachi

    All rights reserved. This program is free software; you can redistribute
    it and/or modify it under the same terms as Perl itself.

HISTORY
    Mail::Message::DB first appeared in fml8 mailing list driver package.
    See "http://www.fml.org/" for more details.

    This class is renamed from "Mail::HTML::Lite" 1.40 (2001-2002).

