MIME::BodyMunger provides methods for rewriting text parts. These methods take care of character sets for you so that you can treat everything like text instead of worrying about content transfer encoding or character set encoding.

At present, only MIME::Entity messages can be handled. Other types will be added in the future.

This method uses the given callback to rewrite the content (body) of the message. It decodes the content (using Content-Transfer-Encoding and the Content-Type charset (or ISO-8859-1, if none is given)) and provides a reference to the character string to the coderef. If the content is altered, the body will be re-encoded into the original charset and the message will be updated.

The callback is invoked like this:

$code->(\$content, $message);

In the future, there should be an option to re-encode to an alternate charset.