
=head1 NAME


Mail::Box::MH::Labels - process file which maintains message related labels

=head1 CLASS INHERITANCE

Mail::Box::MH::Labels
   is a Mail::Reporter

=head1 SYNOPSIS


 my $labels = Mail::Box::MH::Labels->new;
 $labels->read(...)
 $labels->write(...)

=head1 DESCRIPTION


MH type message folders use one dedicated file per folder-directory to list
special tags to messages in that folder.  By doing this, mail agents may
avoid parsing all the messages, which is very resource consuming.

Labels can be used to group messages, for instance to reflect which
messages have been read or which look like spam.

Typically, the file which contains the labels is called C<.mh_sequences>.
The MH messages are numbered from C<1>.  As example content for
C<.mh_sequences>:

 cur: 93
 unseen: 32 35-56 67-80

To generalize labels on messages, two are treated specially:

=over 4

=item * cur

The C<cur> specifies the number of the message where the user stopped
reading mail from this folder at last access.  Internally in these
modules referred to as label C<current>.

=item * unseen

With C<unseen> is listed which message was never read.
This must be a mistake in the design of MH: it must be a source of
confusion.  People should never use labels with a negation in the
name:

 if($seen)           if(!$unseen)    #yuk!
 if(!$seen)          if($unseen)
 unless($seen)       unless($unseen) #yuk!

So: label C<unseen> is translated into C<seen> for internal use.

=back

=head1 METHODS

=head2 Initiation

=over 4

=item B<new> OPTIONS X<new>

 OPTION               DEFAULT
 filename             <required>
 log                  'WARNINGS'
 trace                'WARNINGS'

=over 4

=item B<filename> =E<gt> FILENAME X<new(filename)>

The FILENAME which is used in each directory to store the headers of all
mails. The filename must be an absolute path.

=item B<log> =E<gt> LEVEL

See Mail::Reporter::new(log)

=item B<trace> =E<gt> LEVEL

See Mail::Reporter::new(trace)

=back

=back

=head2 The Label Table

=over 4

=item B<filename>  X<filename>

Returns the name of the index file.

=item B<get> MSGNR X<get>

Look if there is label info for message MSGNR.

=back

=head2 Reading and Writing [internals]

=over 4

=item B<append> MESSAGES X<append>

Append the label information about the specified MESSAGES to the end
of the label file.  The information will not be merged with the
information already present in the label file.

=item B<print> FILEHANDLE, MESSAGES X<print>

Print the labels of the specified messages to the opened file.

=item B<read>  X<read>

Read all label information from file.

=item B<write> MESSAGES X<write>

Write the labels related to the specified messages to the label file.

=back

=head2 Logging and Tracing

=over 4

=item B<errors> 

See Mail::Reporter::errors()

=item B<log> [LEVEL [,STRINGS]]

See Mail::Reporter::log()

=item B<report> [LEVEL]

See Mail::Reporter::report()

=item B<reportAll> [LEVEL]

See Mail::Reporter::reportAll()

=item B<trace> [LEVEL]

See Mail::Reporter::trace()

=item B<warnings> 

See Mail::Reporter::warnings()

=back

=head2 Other Methods

=over 4

=item B<AUTOLOAD> 

See Mail::Reporter::AUTOLOAD()

=item B<DESTROY> 

See Mail::Reporter::DESTROY()

=item B<inGlobalDestruction> 

See Mail::Reporter::inGlobalDestruction()

=item B<logPriority> LEVEL

See Mail::Reporter::logPriority()

=item B<logSettings> 

See Mail::Reporter::logSettings()

=item B<notImplemented> 

See Mail::Reporter::notImplemented()

=back

=head1 SEE ALSO

A good start to read is Mail::Box-Overview.
More documentation and a mailinglist are available from the project's
website at L<http://perl.overmeer.net/mailbox/>.

=head1 AUTHOR

Mark Overmeer (L<mark@overmeer.net|mailto:mark@overmeer.net>) with the help of many.

=head1 VERSION

This code is beta, version 2.019.

Copyright (c) 2001-2002 Mark Overmeer. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
