mhonarc-users

MHonArc API (was Re: Statistics)

1998-04-24 10:27:23
On April 24, 1998 at 11:24, Richard Carlier wrote:

How can I (if I can...) make statistics on my archives ?

Sort of :

50% messages on sunday
30% messages on monday
etc...
by month, etc..

The 10 most talkatives :
carlierr(_at_)imaginet(_dot_)fr : 201 mess, 10%
toto(_at_)nowhere(_dot_)net : 140 mess, 8%
etc...

The best approach is to read the db file directly and compute
the stats you want from it.  It will require knowing some of
the internals of mhonarc.

Note, I am doing some code restructuring for the next release to make
it easier to write utilites for mhonarc archives.  I.e.  I am trying to
develop a basic API.  For example, the source file "mhonarc" (the main
program) looks like this:

    require 'mhamain.pl' || die qq/ERROR: Unable to require "mhamain.pl"\n/;
    &mhonarc::initialize();
    &mhonarc::process_input() ? exit(0) : exit(-1);

The API is not OO (since it that would require a complete rewrite).  It
is more C-like (functional).  There will be functions that allow a more
finer control of doing archive operations.  For example, here is an
example to delete messages from an archive:

    mhonarc::initialize();
    mhonarc::process_input(
                    '-outdir', $archive,
                    '-quiet',
                    '-rmm',
                    @msgnum);

An example to create a custom index (a single page of a custom
multi-page index):

    ## Open archive
    mhonarc::open_archive(
                    '-outdir', $archive,
                    '-quiet',
                    '-nodoc',
                    '-multipg',
                    '-idxsize', $pagesize,
                    "-$sort",
                    $thread ? ('-nomain', '-thread') :
                              ('-nothread', '-main'),
                    '-genidx');
    ## Close archive (archive data stays in memory, frees lock)
    mhonarc::close_archive();

    ## Compute threads (if needed)
    mhonarc::compute_threads()  if $thread;

    ## Print index
    $thread ? mhonarc::write_thread_index($pagenum) :
              mhonarc::write_main_index($pagenum);


These examples are not complete; they are part of a larger program.
However, they do give an idea of what is possible for the next
release.

For doing statistics as mentioned above, you will need to know
more about the internals since you will need to access the various
hashes directly and some lower level functions to do what is
needed.

        --ewh

P.S.  The next release v2.3 will require Perl 5.  I decided it is not
worth to keep Perl 4 syntax.  Although v2.3 is not a OO-style
implementation, there are features of Perl 5 that makes things easier,
and cleaner, to implement.  v2.2 will be the last Perl 4-compatible
release.

----
             Earl Hood              | University of California: Irvine
      ehood(_at_)medusa(_dot_)acs(_dot_)uci(_dot_)edu      |      Electronic 
Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME

<Prev in Thread] Current Thread [Next in Thread>