OVERLOADED

overload: ""
See "" in Mail::Message::Field.
overload: 0+
See 0+ in Mail::Message::Field.
overload: <=>
See <=> in Mail::Message::Field.
overload: bool
See bool in Mail::Message::Field.
overload: cmp
See cmp in Mail::Message::Field.
overload: stringification
See stringification in Mail::Message::Field::Full.

METHODS

See METHODS in Mail::Reporter

Constructors

$obj->clone
See clone in Mail::Message::Field.
$class->from( FIELD, OPTIONS )
See from in Mail::Message::Field::Full.
$class->new( DATA )

  • new LINE
    Pass a LINE as it could be found in a file: a (possibly folded) line which is terminated by a new-line.

  • new NAME, BODY, OPTIONS
    A set of values which shape the line.

The NAME is a wellformed header name (you may use wellformedName()) to be sure about the casing. The BODY is a string, one object, or an ref-array of objects. In case of objects, they must fit to the constructor of the field: the types which are accepted may differ. The optional ATTRIBUTE list contains Mail::Message::Field::Attribute objects. Finally, there are some OPTIONS.

Option Defined in Default

attributes

[]

charset

Mail::Message::Field::Full

undef

datum

undef

encoding

Mail::Message::Field::Full

'q'

force

Mail::Message::Field::Full

false

language

Mail::Message::Field::Full

undef

log

Mail::Reporter

'WARNINGS'

trace

Mail::Reporter

'WARNINGS'

attributes => ATTRS
There are various ways to specify these attributes: pass a reference to an array which list of key-value pairs representing attributes, or reference to a hash containing these pairs, or an array with Mail::Message::Field::Attribute objects.
charset => STRING
datum => STRING
The method name body is very confusing, even in the RFC. In MailBox, for historical reasons, body() returns the part of the field contents before the first semi-colon. foldedBody() and unfoldedBody() address the whole field.
There is no common name for the piece of data before the parameters (attributes) in the field-content mentioned in the RFCs, so let's call it datum.
encoding => 'q'|'Q'|'b'|'B'
force => BOOLEAN
language => STRING
log => LEVEL
trace => LEVEL
» Example: of a structured field
 my @attrs   = (Mail::Message::Field::Attribute->new(...), ...);
 my @options = (extra => 'the color blue');
 my $t = Mail::Message::Field::Full->new(To => \@addrs, @attrs, @options);

The field

$obj->isStructured
$class->isStructured
See isStructured in Mail::Message::Field.
$obj->length
See length in Mail::Message::Field.
$obj->nrLines
See nrLines in Mail::Message::Field.
$obj->print( [FILEHANDLE] )
See print in Mail::Message::Field.
$obj->size
See size in Mail::Message::Field.
$obj->string( [WRAP] )
See string in Mail::Message::Field.
$obj->toDisclose
See toDisclose in Mail::Message::Field.

Access to the name

$obj->Name
See Name in Mail::Message::Field.
$obj->name
See name in Mail::Message::Field.
$obj->wellformedName( [STRING] )
See wellformedName in Mail::Message::Field.

Access to the body

$obj->body
See body in Mail::Message::Field.
$obj->decodedBody( OPTIONS )
See decodedBody in Mail::Message::Field::Full.
$obj->folded
See folded in Mail::Message::Field.
$obj->foldedBody( [BODY] )
See foldedBody in Mail::Message::Field.
$obj->stripCFWS( [STRING] )
$class->stripCFWS( [STRING] )
See stripCFWS in Mail::Message::Field.
$obj->unfoldedBody( [BODY, [WRAP]] )
See unfoldedBody in Mail::Message::Field.

Access to the content

$obj->addresses
See addresses in Mail::Message::Field.
$obj->attrPairs

Returns a list with attribute name and value pairs.

$obj->attribute( OBJECT|(STRING, OPTIONS)|(NAME,VALUE,OPTIONS) )

Add an attribute to the field. The attributes are added left-to-right into the string representation of the field, although the order of the attributes is un-important, according to the RFCs.

You may pass a fully prepared Mail::Message::Field::Attribute OBJECT, if you like to do all preparations for correct representation of the data yourself. You may also pass one STRING, which is a fully prepared attribute. This STRING will not be changed, so be careful about quoting and encodings.

As third possibility, you can specify an attribute NAME and its VALUE. An attribute object will be created for you implicitly in both cases where such object is not supplied, passing the OPTIONS. See Mail::Message::Field::Attribute::new() about the available OPTIONS.

The attribute object is returned, however, when continuations are used this may be an object you already know about. undef is returned when construction fails (when the attribute is incorrect).

» Example:
 $f->attribute(filename => 'passwd');
 $f->attribute(filename => 'passwd', use_continuations => 0);

 my $attr = Mail::Message::Field::Attribute->new(...);
 $f->attribute($attr);
$obj->attributes

Returns a list with all attributes, which are all Mail::Message::Field::Attribute objects. The attributes are not ordered in any way. The list may be empty. Double attributes or continuations are folded into one.

$obj->beautify
See beautify in Mail::Message::Field::Full.
$obj->comment( [STRING] )
See comment in Mail::Message::Field.
$obj->createComment( STRING, OPTIONS )
$class->createComment( STRING, OPTIONS )
See createComment in Mail::Message::Field::Full.
$obj->createPhrase( STRING, OPTIONS )
$class->createPhrase( STRING, OPTIONS )
See createPhrase in Mail::Message::Field::Full.
$obj->study
See study in Mail::Message::Field.
$obj->toDate( [TIME] )
$class->toDate( [TIME] )
See toDate in Mail::Message::Field.
$obj->toInt
See toInt in Mail::Message::Field.

Other methods

$obj->dateToTimestamp( STRING )
$class->dateToTimestamp( STRING )
See dateToTimestamp in Mail::Message::Field.

Internals

$obj->consume( LINE | (NAME,BODY|OBJECTS) )
See consume in Mail::Message::Field.
$obj->decode( STRING, OPTIONS )
$class->decode( STRING, OPTIONS )
See decode in Mail::Message::Field::Full.
$obj->defaultWrapLength( [LENGTH] )
See defaultWrapLength in Mail::Message::Field.
$obj->encode( STRING, OPTIONS )
See encode in Mail::Message::Field::Full.
$obj->fold( NAME, BODY, [MAXCHARS] )
$class->fold( NAME, BODY, [MAXCHARS] )
See fold in Mail::Message::Field.
$obj->setWrapLength( [LENGTH] )
See setWrapLength in Mail::Message::Field.
$obj->stringifyData( STRING|ARRAY|OBJECTS )
See stringifyData in Mail::Message::Field.
$obj->unfold( STRING )
See unfold in Mail::Message::Field.

Parsing

$obj->consumeComment( STRING )
$class->consumeComment( STRING )
See consumeComment in Mail::Message::Field::Full.
$obj->consumeDotAtom( STRING )
See consumeDotAtom in Mail::Message::Field::Full.
$obj->consumePhrase( STRING )
$class->consumePhrase( STRING )
See consumePhrase in Mail::Message::Field::Full.
$obj->datum( [VALUE] )

The part of the field before the semi-colon (;).

$obj->parse( STRING )
See parse in Mail::Message::Field::Full.
$obj->produceBody
See produceBody in Mail::Message::Field::Full.

Error handling

$obj->AUTOLOAD
See AUTOLOAD in Mail::Reporter.
$obj->addReport( OBJECT )
See addReport in Mail::Reporter.
$obj->defaultTrace( [LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK] )
$class->defaultTrace( [LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK] )
See defaultTrace in Mail::Reporter.
$obj->errors
See errors in Mail::Reporter.
$obj->log( [LEVEL [,STRINGS]] )
$class->log( [LEVEL [,STRINGS]] )
See log in Mail::Reporter.
$obj->logPriority( LEVEL )
$class->logPriority( LEVEL )
See logPriority in Mail::Reporter.
$obj->logSettings
See logSettings in Mail::Reporter.
$obj->notImplemented
See notImplemented in Mail::Reporter.
$obj->report( [LEVEL] )
See report in Mail::Reporter.
$obj->reportAll( [LEVEL] )
See reportAll in Mail::Reporter.
$obj->trace( [LEVEL] )
See trace in Mail::Reporter.
$obj->warnings
See warnings in Mail::Reporter.

Cleanup

$obj->DESTROY
See DESTROY in Mail::Reporter.