Cyrus::HeaderFile(3p)

NAME
Cyrus::HeaderFile - A pure perl interface to the "cyrus.header" file format as generated by Cyrus IMAPd.

EXAMPLES
Like Cyrus::IndexFile, uses fcntl locking (default for Cyrus on systems which support it)

my $header = Cyrus::HeaderFile->new_file("path/to/cyrus.header");

XXX: see index_uids.pl

PUBLIC API

Cyrus::HeaderFile->new($fh)
    Read the header file in $fh

Cyrus::HeaderFile->new_file($fname, $lockopts)
    Open the file to read, optionally locking it with IO::File::fcntl. If you pass a scalar for lockopts then it will be locked with ['lock_ex'], otherwise you can pass a tuple, e.g. ['lock_ex', 5] for a 5 second timeout.

    This function will die if it can't open or lock the file. On success, it calls $class->new() with the filehandle.

$header->header([$Field])
    Return the entire header as a hash, or individual named field.

$header->write_header($fh, $headerData)
    Write a header file with the data (e.g. returned from ->header()) to the given filehandle.

$header->write_newheader($fh, $headerData)
    Write a new-style header file with the data (e.g. returned from ->{dlistheader}) to the given filehandle.