Manages the message's body encodings and decodings on request of the main program. This package adds functionality to the Mail::Message::Body class when the decoded() or encode() method is called.

Four types of encodings are handled (in the right order)

eol encoding

Various operating systems have different ideas about how to encode the line termination. UNIX uses a LF character, MacOS uses a CR, and Windows uses a CR/LF combination. Messages which are transported over Internet will always use the CRLF separator.

transfer encoding

Messages transmitted over Internet have to be plain ASCII. Complicated characters and binary files (like images and archives) must be encoded during transmission to an ASCII representation.

The implementation of the required encoders and decoders is found in the Mail::Message::TransferEnc set of packages. The related manual page lists the transfer encodings which are supported.

Check the content of the body not to include illegal characters. Which characters are considered illegal depends on the encoding of this body.

A body is returned which is checked. This may be the body where this method is called upon, but also a new object, when serious changes had to be made. If the check could not be made, because the decoder is not defined, then undef is returned.

If the CODESET is explicitly specified (for instance iso-8859-10, then the data is interpreted as raw bytes (blob), not as text. However, in case of PERL, it is considered to be an internal representation of characters (either latin1 or Perl's utf8 --not the same as utf-8--, you should not know).

The type of body to be created when the body is changed to fulfill the request on re-coding. Also the intermediate stages in the translation process (if needed) will use this type. CLASS must extend Mail::Message::Body.

Encode the body to a format what is acceptable to transmit or write to a folder file. This returns the body where this method was called upon when everything was already prepared, or a new encoded body otherwise. In either case, the body is checked.

Unify the type of the given BODY objects with the type of the called body. undef is returned when unification is impossible. If the bodies have the same settings, the BODY object is returned unchanged.

Returns the name which can be used as filename to store the information in the indicated DIRECTORY. To get a filename, various fields are searched for filename and name attributes. Without DIRECTORY, the name found will be returned.

Only the basename of the found name will be used, for security reasons: otherwise, it may be possible to access other directories than the one indicated. If no name was found, or the name is already in use, then an unique name is generated.

Relate the NAMEd transfer encoding to an OBJECTs or object of the specified CLASS. In the latter case, an object of that CLASS will be created on the moment that one is needed to do encoding or decoding.