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.

METHODS

See METHODS in Mail::Reporter

Constructors

$obj->clone
See clone in Mail::Message::Field.
$class->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

    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|OBJECTS), [ATTRIBUTES]

    A set of values which shape the line.

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 Defined in Default

log

Mail::Reporter

<disabled>

trace

Mail::Reporter

<disabled>

log => LEVEL
trace => LEVEL
» Example:
 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 => 'Latin1');

 my $mime = Mail::Message::Field->new(
  To => Mail::Address->new('My', 'me@example.com');

 my $mime = Mail::Message::Field->new(
  Cc => [ Mail::Address->new('You', 'you@example.com')
        , Mail::Address->new('His', 'he@example.com')
        ]);

But in practice, you can simply call

 my $head = Mail::Message::Head->new;
 $head->add( 'Content-Type' => 'text/plain'
           , charset => 'utf8');

which implicitly calls this constructor (when needed). You can specify the same things for Mail::Message::Head::Complete::add() as this new accepts.

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->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->attribute( NAME [, VALUE] )
See attribute in Mail::Message::Field.
$obj->attributes
See attributes in Mail::Message::Field.
$obj->comment( [STRING] )
See comment in Mail::Message::Field.
$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->defaultWrapLength( [LENGTH] )
See defaultWrapLength in Mail::Message::Field.
$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.

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.
$obj->inGlobalDestruction
See inGlobalDestruction in Mail::Reporter.