NAME
Mail::Message::Field::Fast - one line of a message header
CLASS INHERITANCE
Mail::Message::Field::Fast is a Mail::Message::Field is a Mail::Reporter
SYNOPSIS
See Mail::Message::Field
DESCRIPTION
This is the faster, but less flexible implementation of a header field. The data is stored in an array, and some hacks are made to speeds things up. Be gentle with me, and consider that each message contains many of these lines, so speed is very important here.
METHODS
Initiation
- consume LINE | (NAME,BODY|OBJECTS)
-
See Mail::Message::Field::consume()
- new DATA
-
The constructor of this object does not follow the usual practise within the Mail::Box suite: it does not use the constructor Mail::Reporter::new(). Therefor it has no logging or tracing facilities.
The method can be used in one of the following ways:
new LINE
new NAME, (BODY|OBJECTS), [ATTRIBUTES]
Create a new header field object. Specify the whole LINE at once, and it will be split-up for you. I case you already have the parts of the header line, you may specify them separately as NAME and BODY.
In case you specify a single OBJECT, or a reference to an array of OBJECTS, these objects are processed to become suitable to fill a field, usually by simple strification. When you specify one or more Mail::Address objects, these are transformed into a string using their
format
method. You may also add one Mail::Message::Field, whose body is taken. In case of an array, the elements are joined into one string with a comma.ATTRIBUTES can be exactly one string which may contain multiple attributes at once, quoted and formatted as required in RFC2822. As alternative, list of key-value pairs can be used. In this case, the values will get quoted if needed and everything formatted as the protocol demands.
OPTION DEFAULT log <disabled> trace <disabled>
Examples:
my $mime = Mail::Message::Field->new( 'Content-Type: text/plain; charset=US-ASCII'); my $mime = Mail::Message::Field->new( 'Content-Type' => 'text/plain; charset=US-ASCII'); my $mime = Mail::Message::Field->new( 'Content-Type' => 'text/plain', 'charset=US-ASCII'); my $mime = Mail::Message::Field->new( 'Content-Type' => 'text/plain', charset => 'US-ASCII'); my $mime = Mail::Message::Field->new( To => Mail::Address->new('my name', 'me@example.com'); my $mime = Mail::Message::Field->new( Cc => [ Mail::Address->new('your name', 'you@example.com') , Mail::Address->new('his name', 'he@example.com') ]);
But in practice, you can simply call
my $head = Mail::Message::Head->new; $head->add('Content-Type' => 'text/plain', charset => 'US-ASCII');
which implicitly calls this constructor (when needed). You can specify the same things for add() as this
new
accepts.
The Field
- clone
-
See Mail::Message::Field::clone()
- isStructured
-
See Mail::Message::Field::isStructured()
- length
-
See Mail::Message::Field::length()
Access to the Field
- Name
-
See Mail::Message::Field::Name()
- addresses
-
See Mail::Message::Field::addresses()
- attribute NAME [, VALUE]
-
See Mail::Message::Field::attribute()
- body
-
See Mail::Message::Field::body()
- comment [STRING]
-
See Mail::Message::Field::comment()
- dateToTimestamp STRING
-
See Mail::Message::Field::dateToTimestamp()
- folded
-
See Mail::Message::Field::folded()
- folded_body [BODY]
-
See Mail::Message::Field::folded_body()
- name
-
See Mail::Message::Field::name()
- nrLines
-
See Mail::Message::Field::nrLines()
- print [FILEHANDLE]
-
See Mail::Message::Field::print()
- size
-
See Mail::Message::Field::size()
- stripCFWS STRING
-
See Mail::Message::Field::stripCFWS()
- toDate [TIME]
-
See Mail::Message::Field::toDate()
- toDisclose
-
See Mail::Message::Field::toDisclose()
- toInt
-
See Mail::Message::Field::toInt()
- toString [WRAP]
-
See Mail::Message::Field::toString()
- unfolded_body [BODY, [WRAP]]
-
See Mail::Message::Field::unfolded_body()
- wellformedName [STRING]
-
See Mail::Message::Field::wellformedName()
Reading and Writing [internals]
- defaultWrapLength [LENGTH]
-
See Mail::Message::Field::defaultWrapLength()
- fold NAME, BODY, [MAXCHARS]
-
See Mail::Message::Field::fold()
- setWrapLength [LENGTH]
-
See Mail::Message::Field::setWrapLength()
- unfold STRING
-
See Mail::Message::Field::unfold()
Logging and Tracing
- defaultTrace [LEVEL, [LEVEL]
-
See Mail::Reporter::defaultTrace()
- errors
-
See Mail::Reporter::errors()
- log [LEVEL [,STRINGS]]
-
See Mail::Reporter::log()
- report [LEVEL]
-
See Mail::Reporter::report()
- reportAll [LEVEL]
-
See Mail::Reporter::reportAll()
- trace [LEVEL]
-
See Mail::Reporter::trace()
- warnings
-
See Mail::Reporter::warnings()
Other Methods
- AUTOLOAD
-
See Mail::Reporter::AUTOLOAD()
- DESTROY
-
See Mail::Reporter::DESTROY()
- inGlobalDestruction
-
See Mail::Reporter::inGlobalDestruction()
- logPriority LEVEL
-
See Mail::Reporter::logPriority()
- logSettings
-
See Mail::Reporter::logSettings()
- notImplemented
-
See Mail::Reporter::notImplemented()
SEE ALSO
A good start to read is Mail::Box-Overview. More documentation and a mailinglist are available from the project's website at http://perl.overmeer.net/mailbox/.
AUTHOR
Mark Overmeer (mark@overmeer.net) with the help of many.
VERSION
This code is beta, version 2.023.
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.