Mail::Header - manipulate mail RFC822 compliant headers |
Mail::Header - manipulate mail RFC822 compliant headers
use Mail::Header;
$head = new Mail::Header; $head = new Mail::Header \*STDIN; $head = new Mail::Header [<>], Modify => 0;
This package provides a class object which can be used for reading, creating, manipulating and writing RFC822 compliant headers.
ARG
may be either a file descriptor (reference to a GLOB)
or a reference to an array. If given the new object will be
initialized with headers either from the array of read from
the file descriptor.
OPTIONS
is a list of options given in the form of key-value
pairs, just like a hash table. Valid options are
IGNORE
- ignore and discard the header,
ERROR
- invoke an error (call die), COERCE
- rename them as Mail-From
and KEEP
- keep them.
VALUE
is false then Mail::Header
will not do any automatic
reformatting of the headers, other than to ensure that the line
starts with the tags given.
OPTION
specifies what to do when a `From '
line is encountered.
Valid values are IGNORE
- ignore and discard the header,
ERROR
- invoke an error (call die), COERCE
- rename them as Mail-From
and KEEP
- keep them.
LENGTH
is not given then Mail::Header
uses the
following rules to determine what length to fold a line.
The fold length for the tag that is begin processed
The default fold length for the tag that is being processed
The default fold length for the object
extract
will modify this array.
Returns the object that the method was called on.
Mail::Header
object of all lines.
header
does multiple operations. First it will extract a header from
the array, if given. It will the reformat the header, if reformatting
is permitted, and finally return a reference to an array which
contains the header in a printable form.
header
, but it will eventually set headers from a hash
reference, and it will return the headers as a hash reference.
The values in the hash might either be a scalar or an array reference, as an example:
$hashref->{From}='Tobias Brox <tobix@cpan.org>'; $hashref->{To}=['you@somewhere', 'me@localhost'];
TAG
is undef the the tag will be
extracted from the beginning of the given line. If INDEX
is given
the new line will be inserted into the header at the given point, otherwise
the new line will be appended to the end of the header.
TAG
is undef the the tag will be
extracted from the beginning of the given line. If INDEX
is given
the new line will replace the Nth instance of that tag, otherwise the
first instance of the tag is replaced. If the tag does not appear in the
header then a new line will be appended to the header.
TAG
into one. The lines will be
joined togther with WITH
, or a single space if not given. The new
item will be positioned in the header where the first instance was, all
other instances of <TAG> will be removed.
INDEX
is given then the text of the Nth
instance will be returned. If it is not given the return value depends on the
context in which get
was called. In an array context a list of all the
text from all the instances of TAG
will be returned. In a scalar context
the text for the first instance will be returned.
INDEX
id given then the Nth instance
of the tag will be removed. If INDEX
is not given all instances
of tag will be removed.
STDOUT
if no
file descriptor is given.
LENGTH
is given it sets the default fold length for the current object.
In the two argument form fold_length
may be called as a static method,
setting default fold lengths for tags that will be used by all
Mail::Header
objects. See the fold
method for
a description on how Mail::Header
uses these values.
TAG
is not given then all lines are unfolded.
Graham Barr. Maintained by Mark Overmeer <mailtools@overmeer.net>
Copyright (c) 2002-2003 Mark Overmeer, 1995-2001 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Mail::Header - manipulate mail RFC822 compliant headers |